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
    Jul 2010
    Thanked 0 Times in 0 Posts

    Exclamation Event Registration Form Issue

    Hey All!

    Well, here I am at PHP Freaks mercy again lol. I love this website and everyone here is always so helpful so let's get to my most recent issue.

    I am developing a pretty simple event registration form, which would be pretty easy in most respects. It will have the following pretty standard fields.

    Number of people attending: (drop down with 1-10)
    Alternate Phone

    There will be a few other fields but they aren't relevant. Basically the first field "Number of people attending (drop down 1-10)" will have to create a section with the following fields above for each person's information. If there are 3 people attending then it will need to have 3 sections of all those fields for each person.

    Making the page dynamically generate those sections on-the-fly when the user selects "3" for example is the first issue I am having. The other issue I am having is how would I handle the information dynamically within the PHP. If there was just one person it would be easy because I could just reference those fields.

    One solution I have for the second problem that I have some experience with is naming the fields name[] for example. But I still don't have a complete grasp on how to make that fix my problem. I've tried googling for hours but have had no luck, which may be because I'm not sure how to phrase the problem maybe.

    Any help!

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Thanked 637 Times in 625 Posts
    This is Coding Forums not PHP Freaks

    Anyway yes you have the right idea, use name[] in your html form and then loop through the resulting array in PHP. Here's a tip on how to work with the form data if you're not sure how it's been generated on the PHP side. Add echo "<pre>".print_r($_POST,true)."</pre>"; to the top of the script and you'll then be able to see what the format of your $_POST array is. Knowing this will help you figure out how to loop through it.


    Posting Permissions

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