A 2 Step Form.

Discussion in 'Programming' started by Riots, Apr 5, 2008.

  1. #1
    How can I setup a 2 step form were someone fills out just some basic info than they click next and ask for just a little more info than emails it. I know its like a contact form. I know how to do a single page contact form. I want to do something like this here.. Thanks any advice be cool
     
    Riots, Apr 5, 2008 IP
  2. it career

    it career Notable Member

    Messages:
    3,562
    Likes Received:
    155
    Best Answers:
    0
    Trophy Points:
    270
    #2
    May be you can try some auto responder stuff.
     
    it career, Apr 6, 2008 IP
  3. Rothzael

    Rothzael Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You'll need a script to do this easily. You can save the information in the path when they press submit on the first page, then just add the information on the second page.
     
    Rothzael, Apr 7, 2008 IP
  4. Xtrm2Matt

    Xtrm2Matt Active Member

    Messages:
    129
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    58
    #4
    Could do something like such:

    
    <?php if( !isset( $_GET[ "step" ] ) || $_GET[ "step" ] == 0 ) { ?>
    
    Step 1.
    
    <form>
    <input type="hidden" name="step" value="1">
    [ enter the rest of the form stuff here ]
    </form>
    
    <?php } elseif( $_GET[ "step" ] == 1 ) { ?>
    
    <?php
    // Catch all of the post variables from the previous form
    $_POST[ "p1_input1" ] == $p1_input1;
    $_POST[ "p1_input2" ] == $p1_input2;
    ?>
    
    Step 2.
    
    <form>
    <input type="hidden" name="step" value="2">
    <input type="hidden" name="input1" value="<?php echo $p1_input1; ?>">
    <input type="hidden" name="input2" value="<?php echo $p1_input2; ?>">
    [ enter the rest of the form stuff here ]
    </form>
    
    <?php } elseif( $_GET[ "step" ] == 2 ) {
    
    <?php
    // Catch all of the post variables from Page 1
    $_POST[ "p1_input1" ] == $p1_input1;
    $_POST[ "p1_input2" ] == $p1_input2;
    
    // Catch all of the post variables from Page 2
    $_POST[ "p2_input1" ] == $p2_input1;
    $_POST[ "p2_input2" ] == $p2_input2;
    
    
    // Do whatever you want here
    mysql_query( "blah blah" );
    mail( $blah, $blah, $blah, $blah );
    die( );
    // Etc.
    ?>
    
    <?php } ?>
    
    PHP:
    Hope it helps.
     
    Xtrm2Matt, Apr 7, 2008 IP
  5. Rob Whisonant

    Rob Whisonant Well-Known Member

    Messages:
    156
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    110
    #5
    The normal way it is done is exactly the way Xtrm2Matt has shown. Just pass them to the next form and include the data in hidden fields.

    Re's
    Rob Whisonant
     
    Rob Whisonant, Apr 8, 2008 IP