There are two field in my form.
1) Html select field item ( From mysql database)
2) Name box.
If a user select a item from html select tag and forgot to write his/her name then with php it’s say..
* Your username required
BUT then it’s doesn’t show the select item which user selected.. it’s show again Select… That’s why another error message appear..
* Please select your item.
How do i show this selected item with php?
Html form:
<tr>
<td>Class</td>
<td>
<select class="td" name="class">
<option selected="selected" value="">Select..</option>
<?php
include_once("../../toplevel/content/manage/dbcon/dbcon.php");
$sql = mysql_query("SELECT * FROM class");
while($re = mysql_fetch_array($sql))
{
$re_class = mysql_real_escape_string(trim($re['c_name']));
echo "<option value='$re_class'> $re_class </option>";
}
?>
</select>
</td>
</tr>
<tr>
<td>Name</td>
<td><input type="text" value="<?php if(isset($_POST['uname'])) echo
$_POST['uname']; ?>" name="uname" class="td" /></td>
</tr>
<tr>
I can do this for Name filed But how do i do this for the select field ?
Thanks a lot.
Shibbir
Did u mean this?