PHP and Registration Forms

Posted on 2005-04-07
Last Modified: 2008-03-06
I currently have a registration form that accepts 1 student registration. I would like this form to have a button that goes to an optional "Add Additional Students" if they decide to click on this so they can continually add as many students as they want, while keeping the form information, or they can just hit submit with the 1 student.

How can I have this work?? Any suggestions on tutorials, scripts, etc?
Question by:Nitestarz
    LVL 4

    Accepted Solution

    The page with the form will have this:
    if (isset($_SESSION['addadditionalstudent']))
        $numstudents = 0;
        print "<form action = pagename.php method=\"POST\">
       foreach($_POST as $name=>$value)
            //skip the submit button
            if($name != "addadditionalstudent")
                print "<input type=hidden name=$name value=value>;
        //where they can enter new students
        print "<input type=text name=student$numstudents>";
        print "<input type=submit name=done value=Done>";
        print "<input type=submit name=addadditionalstudent value=\"Add Additional Students\">";
        /*add the posted data to database here... the posted data can be printed (as an example) by doing    
         foreach($_POST as $name=>$value)
                print $value . "<br>\n";

    There might be some small errors in this code as it has not been tested, but everything looks right.
    LVL 14

    Expert Comment

    No comment has been added to this question in more than 21 days, so it is now classified as abandoned..
    I will leave the following recommendation for this question in the Cleanup topic area:
    Accept: cachedVB {http:#13731328}

    Any objections should be posted here in the next 4 days. After that time, the question will be closed.

    EE Cleanup Volunteer

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
    I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now