How to split a long form into two pages and have all field submit at the end.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chifm
    New Member
    • Jul 2007
    • 1

    How to split a long form into two pages and have all field submit at the end.

    Hi ALL,

    I dont know much about php, but have got a long form that i need to split into two pages, i want to have the inputs from the page 1 past to page 2 and all submitted via email at the end. I am really stock on this one. I have managed to split the form and I have used the php 'GET' and i could see the inputs at in url. Please any help will be most appreciated.

    Please find below the form below/
    Code:
    <form action="/form2.php" method="get" name="entery" id="entery" onsubmit="return checkFields()">
    
    
    
    <fieldset>
    <legend>About you:
    
    </legend>
    
    
    <table border="0" bordercolor="#999999" cellpadding="0" cellspacing="0" width="530">
    
    <td>Residential Status:<br>
    
    
    
    
    
    <select style="width: 140px;" name="ResidentialStatus" id="ResidentialStatus" size="1" onchange="if ((this.options[this.selectedIndex].value=='StudentAcc')||(this.options[this.selectedIndex].value=='Tenant')||(this.options[this.selectedIndex].value=='LivingWP')) document.location.href='unsecured.html'; checkFieldBack(this)">
    <option value="" selected="selected">-
    Select - </option>
    
    <option value="homeowner">Homeowner with
    mortgage</option>
    <option value="Tenant">Own home outright</option>
    <option value="StudentAcc">Student Acc.</option>
    <option value="Tenant">Tenant</option>
    <option value="LivingWP">Living w/parents</option>
    </select>
    </td>
    
    <td>Loan Purpose: <br>
    
    
    <select name="Loan_purpose" id="Loan_purpose">
    <option value="" selected="selected">-Please
    Select-</option>
    
    <option value="Car Loan">Car Loan</option>
    <option value="Home Improvement">Home
    Improvement</option>
    <option value="Consolidation">Consolidation</option>
    <option value="Holiday">Holiday</option>
    <option value="Overdraft">Overdraft</option>
    <option value="Mortgage">Mortgage</option>
    
    <option value="Remortgage">Remortgage</option>
    <option value="Business Loan">Business Loan</option>
    <option value="Other">Other</option>
    </select>
    
    
    
    </td>
    
    
    <td>Loan Amount: <br>
    
    <select name="Loan Amount" style="width: 140px;">
    <option value="6000">&pound;6,000</option>
    <option value="7000">&pound;7,000</option>
    <option value="8000">&pound;8,000</option>
    
    
    <option value="90000">&pound;90,000</option>
    
    <option value="100000">&pound;100,000</option>
    <option value="More than 100000">&pound;100,000+</option>
    </select>
    
    </td>
    
    </table>
    </p>
    
    
    
    <input type="image" value="submit" src="../i/1x1.gif" width="100" height="30">
    
    
    
    [B]form2[/B]
    
    
    <form action="/formmail.php" method="post" name="form" id="form" onsubmit="return checkForm()">
    
    
    
    <fieldset><legend>About you: </legend>
    
    
    <table border="0" bordercolor="#999999" cellpadding="0" cellspacing="0" width="530">
    
    
    
    <tbody>
    
    
    
    <td width="180"><br>
    
    
    
    First Name:&nbsp;<br>
    
    
    
    
    <select class="list_menu" id="Loans_title1" style="width: 40px;" size="1" name="Loans_title1" onchange="checkPMrs(this.value)">
    <option value="Mr" selected="selected">Mr</option>
    <option value="Mrs">Mrs</option>
    <option value="Miss">Miss</option>
    <option value="Ms">Ms</option>
    </select>
    
    
    
    <input id="First_Name" style="width: 100px;" maxlength="20" size="22" name="First_Name" onkeyup="checkFieldBack(this)"></td>
    
    
    
    <td width="180">Surname:<br>
    
    
    
    <input id="Surname" style="width: 140px;" maxlength="20" size="22" name="Surname" onkeyup="checkFieldBack(this)"></td>
    
    
    <td width="180">Date Of Birth:<br>
    
    
    <select class="list_menu" id="Date_of_Birth_Day" style="width: 45px;" name="Date_of_Birth_Day" onchange="checkFieldBack(this)">
    <option value="" selected="selected">dd</option>
    <option value="01">01</option>
    <option value="02">02</option>
    
    <option value="03">03</option>
    <option value="04">04</option>
    <option value="05">05</option>
    <option value="06">06</option>
    <option value="07">07</option>
    <option value="08">08</option>
    
    
    
    <option value="1908">1908</option>
    </select>
    
    </td>
    
    
    </tr>
    
    <td><br>
    
    
    
    Mother's Maiden name:<br>
    
    
    
    <input id="Mothers_Maiden_Name" style="width: 140px;" name="Mothers_Maiden_Name" onkeyup="checkFieldBack(this)"></td>
    
    
    
    <td valign="top">Job Status:<br>
    
    
    <select id="Job_Status" name="Job_Status" style="width: 140px;">
    
    <option value="">- Select -</option>
    <option value="Full Time" selected="selected">Full
    Time</option>
    <option value="Part Time">Part Time</option>
    <option value="Self Employed">Self Employed</option>
    <option value="Retired">Retired</option>
    <option value="Unemployed">Unemployed</option>
    
    <option value="Homemaker">Homemaker</option>
    </select>
    
    
    </td>
    
    <td valign="top">Occupation:<br>
    
    
    <input id="Occupation" style="width: 140px;" maxlength="50" name="Occupation" onkeyup="checkFieldBack(this)"></td>
    
    
    </tr>
    
    
    <td><br>
    
    
    
    Yearly Income:<br>
    
    
    
    <select id="Yearly_Income" name="Yearly_Income" style="width: 140px;" onchange="checkFieldBack(this)">
    <option value="" selected="selected">-
    Select -</option>
    <option value="1000">&pound;1,000</option>
    
    <option value="2000">&pound;2,000</option>
    <option value="3000">&pound;3,000</option>
    <option value="4000">&pound;4,000</option>
    <option value="5000">&pound;5,000</option>
    <option value="6000">&pound;6,000</option>
    <option value="7000">&pound;7,000</option>
    
    
    <option value="17000">&pound;17,000</option>
    <option value="18000">&pound;18,000</option>
    <option value="19000">&pound;19,000</option>
    
    
    <option value="100000">&pound;100,000</option>
    </select>
    
    
    </td>
    
    
    
    <td width="180">Property Value:<br>
    
    
    <select id="Property_Value" style="width: 140px;" maxlength="50" name="Property_Value" onchange="checkFieldBack(this)">
    <option value="" selected="selected">-
    Select -</option>
    <option value="50000">&pound;50,000</option>
    <option value="60000">&pound;60,000</option>
    <option value="70000">&pound;70,000</option>
    
    
    
    <option value="980000">&pound;980,000</option>
    <option value="990000">&pound;990,000</option>
    <option value="1000000">&pound;1,000,000</option>
    </select>
    
    
    
    </td>
    
    
    <td width="180"> Mortgage Balance:<br>
    
    
    
    
    
    <select id="Mortgage_Outstanding" style="width: 140px;" name="Mortgage_Outstanding" onchange="checkFieldBack(this)">
    <option value="" selected="selected">-
    Select -</option>
    <option value="1000">&pound;1,000</option>
    
    <option value="2000">&pound;2,000</option>
    <option value="3000">&pound;3,000</option>
    <option value="4000">&pound;4,000</option>
    <option value="5000">&pound;5,000</option>
    <option value="6000">&pound;6,000</option>
    <option value="7000">&pound;7,000</option>
    
    
    <option value="975000">&pound;975,000</option>
    <option value="1000000">&pound;1,000,000</option>
    </select>
    
    
    
    </td>
    
    
    
    
    
    </tr>
    
    
    
    
    
    </tbody>
    
    
    </table>
    
    
    </fieldset>
    
    
    
    
    
    <div id="finishButton">
    
    
    <p>&nbsp; &nbsp; &nbsp;All Done? Click
    "FINISH" to get your quote
    &raquo;&nbsp; <input name="submit" value="Finish!" type="submit"></p></form>



    sorry this seems to be a very long form.
    Last edited by Niheel; Jan 24 '11, 03:58 PM.
  • tscott
    New Member
    • Jul 2007
    • 22

    #2
    Hey,
    Would it be possible to send half of it to the next page VIA post, then set them as variables then do something like (Sending it to next page)
    [php]
    <?php
    $var1 = $_POST['var1'];
    $var2 = $_POST['var2'];
    echo '<form method=POST action=somethin g.php?var1=' . $var1 .'&var2=' . $var2 .' >The second page form would go here </form>';
    ?>
    [/php]
    That would send half via GET and half via POST allowing you to continue the trend. Although GET isn't very secure So if your using it for private data it may not be the best. But for general purposes it should be fine. Only easy way I know unless you want to store it in a cookie/session/file until the last page.
    ~Tyler

    Comment

    • TheTVDudedede
      New Member
      • Jan 2011
      • 1

      #3
      Hi, I'm new to the forum

      Hello,

      I'm an avid Family Guy Fan, have made my own website - see my signature if you want to view it.

      Just browsing the forum as I am interested in it.

      Hoping to get to make some ebuddies here!

      Comment

      • HaLo2FrEeEk
        Contributor
        • Feb 2007
        • 404

        #4
        Send them both with POST and on the second page, simply loop through the POST array and echo out inputs wth type="hidden". For example, write your first page form and set its method to post, ten on the second page, do something like this, AFTER you're already echoed the form start tag:

        Code:
        foreach($_POST as $name=>$value) {
          echo "<input type=\"hidden\" name=\"".$name."\" id=\"".$name."\" value=\"".$value."\">\n";
          }
        This will result in each of the values from the first page essentially being auto-populated on the second form, but they're hidden, so they don't actually appear anywhere on the page. Keep in mind, however, that the user could simply use something like Developer Tools in IE8+ and change the values in the hidden inputs, but they could do that if you used tscott's method too, and it's a bad idea to submit any part of your form with GET, especially if it contains or controls personal information.
        Last edited by HaLo2FrEeEk; Jan 24 '11, 02:03 AM. Reason: Fixed a typo in the code :/

        Comment

        Working...