View Full Version : Keep selection of drop down from menu

12-28-2006, 11:22 PM
Hi guys,


Im just working on a enquiry form submission script. When the form is submitted a php scripts checks for empty fields etc. If a empty field is found the for comes back and a error messages is displayed.

When the forms re-appears the fields which werent filled out correctly before stay filled in, simply putting setting the fields 'value' with the $_post variables.

Now this is ok but is there a way so if the users selects a choice from my drop menu the first time that this choice remains when the form re-appears if something else was found to be invalid ??

Hope I explained that ok ??

This is the form here if you want to look.


:confused: :thumbsup:

12-29-2006, 01:27 AM
Couple of options... first is to use sessions (this is what I'd recommend).

Second is store form info in a table, flagging the info as "temporary".

12-29-2006, 11:35 AM
Since your process_email.php form posts to itself for validation, you could just easily replace the method you use to output the select box with a small php routine that will flag whichever one was selected on the form entry as selected