how to retain list value on form
Posted: Mon Sep 21, 2009 11:02 pm
Hi friends.....
i have some select box in my form like
<label>1. Sex</label>
<select name="sx">
<option value='M'>Male</option>
<option value='F' >Female</option>
</select>
<br><br>
when i select Female and suppose there is an error in Name field , at that time when page reloded it will again reset the selected value i.e Male will appear in form...
for name field i am using value="<?php if (isset($_POST['submit'])) echo $_POST['name']; ?>" in the input labe ...in same way is there any option for select box
thank you
i have some select box in my form like
<label>1. Sex</label>
<select name="sx">
<option value='M'>Male</option>
<option value='F' >Female</option>
</select>
<br><br>
when i select Female and suppose there is an error in Name field , at that time when page reloded it will again reset the selected value i.e Male will appear in form...
for name field i am using value="<?php if (isset($_POST['submit'])) echo $_POST['name']; ?>" in the input labe ...in same way is there any option for select box
thank you