PHP and Registration Forms

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?
NitestarzAsked:
Who is Participating?
 
cachedVBConnect With a Mentor Commented:
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>;
            $numstudents++;
        }
    }  
    //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\">";
}
else
{
    /*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.
0
 
hujiCommented:
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.

Huji
EE Cleanup Volunteer
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.