I have a selection list/combo box with options for the user to select. The problem is when i select an item from the list and then hit the submit button, it reverts the option to the first item in the list as opposed to the one the user has selected. How do i get it to keep displaying the item the user has selected after submitting???
I assume you are posting the form data to the same page when you submit it? You need alter your select statement to: <SELECT name="fieldname" size="1"> <OPTION <?php if($fieldname=="0"){ echo "selected"; } ?>>0</OPTION> <OPTION <?php if($fieldname=="1"){ echo "selected"; } ?>>1</OPTION> <OPTION <?php if($fieldname=="2"){ echo "selected"; } ?>>2</OPTION> </SELECT> PHP: Make sure you also register the $fieldname variables at the start of the page by doing $fieldname = $_POST['fieldname']; or $fieldname = $_GET['fieldname'];
In asp, just set a session variable and then check the variable on the next page and set the correct option to "selected" in the combo box.