select box value not updated.
Posted: Wed Jun 06, 2012 9:10 pm
I use select box to select title of the person in html. When I save value for the first time in mysql table it works fine. When I retrieve the value to the select box from mysql and update without changing the select box value it does not updated in the table. But if I change the select box value and update then it updated in the table. Any help please.
select box:
<select name="lsttitle" size="1" id="lsttitle" title="">
<option value="" Selected="Selected"><?php echo $title;?></option>
<option value="Mr.">Mr.</option>
<option value="Ms.">Ms.</option>
</select>
update query:
mysql_query("UPDATE tblClient SET ClientName='$_POST[txtClientName]', Date='$_POST[txtDate]', Title='$_POST[lsttitle]', ClientAddress='$_POST[txtAddress]', NICNo='$_POST[txtNICNo]', ContactNo1='$_POST[txtContact1]', ContactNo2='$_POST[txtContact2]' WHERE LMNo=$LMNo") or die(mysql_error());
select box:
<select name="lsttitle" size="1" id="lsttitle" title="">
<option value="" Selected="Selected"><?php echo $title;?></option>
<option value="Mr.">Mr.</option>
<option value="Ms.">Ms.</option>
</select>
update query:
mysql_query("UPDATE tblClient SET ClientName='$_POST[txtClientName]', Date='$_POST[txtDate]', Title='$_POST[lsttitle]', ClientAddress='$_POST[txtAddress]', NICNo='$_POST[txtNICNo]', ContactNo1='$_POST[txtContact1]', ContactNo2='$_POST[txtContact2]' WHERE LMNo=$LMNo") or die(mysql_error());