[thelist] Drop down box resets after "Submit"

Anthony Baratta Anthony at Baratta.com
Thu Jun 10 12:26:56 CDT 2004


At 09:44 AM 6/10/2004, Leigh.DSylva at cas.gov.on.ca wrote:

>In an HTML form, I have a drop down box that is populated from a MySQL
>database. When the user chooses an option from the list and clicks "Submit"
>the form calls itself ($PHP_SELF) but when the screen is re-drawn the
>user's choice is no longer showing in the drop down list but rather the
>first option from the list.
>
>Is there a way I can make the form remember the user's choice so that it
>displays in the drop down after submit has been clicked?

When you build the drop down box, look for the form post for that element. 
If the posted form value is not empty, set the selected state of that 
element to the form value.

-- 
Anthony Baratta
President
Keyboard Jockeys

"Conformity is the refuge of the unimaginative."



More information about the thelist mailing list