Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2009
    Thanked 0 Times in 0 Posts

    Question PHP drop down list selector

    I have three files:
    MASTER PAGE.html
    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.

  2. #2
    Regular Coder
    Join Date
    Feb 2009
    Thanked 63 Times in 54 Posts
    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:

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

    Last edited by Lamped; 10-27-2009 at 04:24 PM.
    lamped.co.uk :: Design, Development & Hosting
    marcgray.co.uk :: Technical blog


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts