View Full Version : PHP drop down list selector

10-27-2009, 03:29 PM
I have three files:
Sign up Page.html

Ok, so I want to have a list of events on a MASTER PAGE

No matter what event a person clicks on they will be taken to the same "sign up page" with a form on it where they enter info into various fields.

contact.php takes the form info and emails it to reservations people.

even though there is only one sign up page is there a way for the event they select to automatically selected from a drop down menu containing every event?

thanks. i am working on the code now but my PHP only gets me to the working form but not the auto selection.

10-27-2009, 04:08 PM
You need to maintain a unique event id, and use that as the name for each select option. Then in the sign up page, you do something like:

foreach($events as $event) {
if ($event['id'] == $_GET['eventid']) {
echo('<option name="'.$event['id'].'" value="'.$event['name'].'" selected="selected" />');
} else {
echo('<option name="'.$event['id'].'" value="'.$event['name'].'" />');