How do I assign the value of a textbox to a variable?
Here is my form:
<form id="" method="post" action="photo_upload.php" enctype="multipart/form-data">
<table align="center" cellpadding="0" cellspacing="0" border="0" width="650px">
<tr>
<td colspan="7">
<input type="text" id="albumName" name="albumName" value="jaghamachi"/>
</td>
</tr>
<tr>
<td width="50px" align="center"/>
<td align="center" width="100px">Upload Pics::</td>
<td align="center" width="50px"/>
<td align="center" width="200px">
<input type="file" id="file" name="file"/>
</td>
<td align="center" width="50px"/>
<td align="center" width="100px">
<input type="submit" name="submit" id="submit" value="submit" class="button" style="width: 100px;" />
</td>
<td align="center" width="50px"/>
<tr>
<td height="16px"/>
</tr>
</table>
</form>
<?php
// here i want a code similar to string str = Text1.Text like in .net;
//i want a code smthng like this
//$value= albumName.value; how to do it?? here albumName is the textbox type in above form
?>
How can it be done, without using javascript or jquery?
You can do it like this:
Here:
$albumName
is the variable name containing value of text box namedalbumName
$POST
is the form methodPOST
eg<form method="POST"
Note 1: For that to work, it is assumed that you submit the form first.
Note 2: To submit to same page, set
action
attribute of<form>
tag to emptyThe only thing you can do is posting the form, and the the value from
$_POST