SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Addict
    Join Date
    May 2007
    Location
    West Coast
    Posts
    339
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    form continuation

    If you have a form submitted & want it to go to another form how does one do that?

    I have the script and everything and they said it is possible but what changes in the simple 1 page form?

    Code:
    	<form action="mail.php" method="post">
    <table>
    <tr><td></td><td></td></tr>
    </table>
    
    	<input type="submit" value="Next">
    This should now go to page 2 of the form while keeping the information on page 1. Once page 2 is submitted it will then post all form info to email.

    What I tried was in the value field using thepage2.html page then it changed the value word to "thepage2.html" instead of next, kind of ugly.

    Or do I try changing form action="mail2.php" method="post">

    and on page 2 go with form action="mail.php"

    If so, then what is in the mail2.php file?

    I think I have the correct way, but only 40% of the answer.

    What would you do?

    NOTE: I want to stick with php.

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,684
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    Have page 1 submit as POST data to page2.php

    The second page can retrieve the POST data and store it in an number of ways.
    Some options for continuation of the data include:
    • Database
    • Session
    • Cookies
    • Hidden form variables
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can either:
    have form1.php submit to form2.php
    form2.php will look for the _POST variable and output the names and values into hidden inputs.
    form2.php will submit to mail.php
    if there's a lot of fields, you can lump them all into a single hidden field by using json_encode() and then base64_encode()

    alternatively, you can store the form data in a session.

  4. #4
    SitePoint Addict
    Join Date
    May 2007
    Location
    West Coast
    Posts
    339
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK, then the problem is the original mailer.php script. It functions as is but I am told it can function with 2 or more pages.

    So how can I break it down into 2 php scripts from 1 or do I need to?

    The original programmer doesn't have the time to go into details.

    maybe a quick working example would help.

  5. #5
    SitePoint Evangelist Waffles's Avatar
    Join Date
    Nov 2005
    Posts
    435
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    some code would be more than useful

  6. #6
    SitePoint Addict eanimator's Avatar
    Join Date
    Sep 2005
    Posts
    396
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why you you want to post the form to another page?

    use CSS technique i.e. style="display:none;" and style="display:block;"

    And use input buttons to navigate between tabs..

    document.getElementById(tabID).style = "none"; // hide tab
    document.getElementById(tabID).style = ""; // show tab

    hope this helps

    good luck


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
  •