PHP and Registration Forms

Posted on 2005-04-07
Medium Priority
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

Accepted Solution

cachedVB earned 500 total points
ID: 13731328
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

ID: 15983743
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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses
Course of the Month16 days, 1 hour left to enroll

850 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