Results 1 to 5 of 5

Thread: add up forms?

  1. #1
    Join Date
    Aug 2006
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Red face add up forms?

    Need Help.....!

    I Have Created 4 .html Forms In Each One Of Them There Is Items To Be Selected.

    I Need The Code That Will Add Up Those Selected Items In The 4 .html Forms Into A A New Window For People To Sumnit What They Selected..



    Please Rsvp Soooooon!!!!

  2. #2
    Join Date
    Mar 2006
    Location
    Cleveland, Ohio
    Posts
    574
    Thanks
    6
    Thanked 5 Times in 5 Posts

    Default

    You'll need to change those four files to .php. Or at least the last 3. The first one can stay HTML, but I wouldn't recommend it.

    Here's what you'll need to do:

    the first form must submit, or "action" to the second form. The method must = "post".

    Now, let's say you give one selection the name "selection1", on the second form, you'll use this code:

    PHP Code:
    <?php

    $selection1 
    $_POST['selection1'];

    ?>
    Now, for however many selections there are, just make new ones. You can change the names to whatever, just make sure they match up.

    Then, you'll create hidden inputs with this information:

    Code:
    <input type="hidden" name="selection1" value="<?=$selection1 ?>" />
    And for every selection, add a new input line like that, just change the names.

    Now, keep carrying these over and over to the next pages, by using the $_POST method I showed you.

    Make sense?

  3. #3
    Join Date
    Aug 2006
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    and the final page where everything is add up....? what's de code? i mean

    xx1.php ....go to ....... xx2.php go to.....xx3.php= ?

    where "?" is the form...

  4. #4
    Join Date
    Mar 2006
    Location
    Cleveland, Ohio
    Posts
    574
    Thanks
    6
    Thanked 5 Times in 5 Posts

    Default

    ok, let's say we have four pages: form1.php, form2.php, form3.php, and form4.php:

    form1.php just has the form, we submit selections named selection1 and selection2.

    so then, form2.php has this code:

    PHP Code:
    <?php

    $selection1 
    $_POST['selection1'];
    $selection2 $_POST['selection2'];

    ?>
    then, you just put the info into hidden inputs, and this is still form2.php:

    Code:
    <input type="hidden" name="selection1" value="<?=$selection1 ?>" />
    <input type="hidden" name="selection2" value="<?=$selection2 ?>" />
    Make sure the php code is at the top of the page.
    Add the other selections, selection3 and selection4 for form2.php then submit the form to form3.php.

    form3.php would be like this...say there's 2 more selections on form3, selection5 and selection6:

    PHP Code:
    <?php

    $selection1 
    $_POST['selection1'];
    $selection2 $_POST['selection2']; //we carry the other two over from form1.php

    $selection3 $_POST['selection3'];
    $selection4 $_POST['selection4']; //and we carry the two over from form2.php

    ?>
    then, we do the inputs again:

    Code:
    <input type="hidden" name="selection1" value="<?=$selection3 ?>" />
    <input type="hidden" name="selection2" value="<?=$selection4 ?>" />
    and we do this for the other page(s)...

    do you get the pattern?

  5. #5
    Join Date
    Aug 2006
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    i really appreciate the time you are taking to help me out...
    ok.....let me understand...

    form1.php, form2.php, form3.php, and form4.php are the pages where :
    people click on a button "next" after choosing items from form1.php, will carry the info to form2.php.....3 and 4 right? and at the end everything that has been selected will add up to the master "submit_info.php"

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •