SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot AVdes's Avatar
    Join Date
    Jun 2005
    Location
    GA
    Posts
    106
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    form advice needed

    You know how some forms exist on two or more pages and then when you click the submit button it first sends you to an agreement page before finally processing your information and giving you the thank you Page?

    I built a simple form in html and php. Now I need a more complex one that uses the above mentioned process. If this is possible with PHP then can someone direct me to a website where I can learn how this is done? Would I have to implement some MySQL?
    CSS Club mantra; "I hate IE6, I hate IE6, I hate IE6".
    http://www.avdes.com

  2. #2
    SitePoint Evangelist
    Join Date
    Aug 2005
    Posts
    453
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AVdes View Post
    I built a simple form in html and php. Now I need a more complex one that uses the above mentioned process. If this is possible with PHP then can someone direct me to a website where I can learn how this is done? Would I have to implement some MySQL?
    You will need to implement some MySQL if you plan on storing the form information in a MySQL database.
    I do not have a website with an example for you, but the logic is fairly simple. You will need to send your form data to a form handler script. This script can be php and simply processes the information before using the header() function to forward you on to another page. In your case the page you send the information to would be the agreement page. Store your form data in a session variable and use the "I agree" button to submit a hidden field to the form handler, this script will store your data in a MySQL database and then forward you to the "Thank You" page.
    Computers and Fire ...
    In the hands of the inexperienced or uneducated,
    the results can be disastrous.
    While the professional can tame, master even conquer.

  3. #3
    SitePoint Wizard Hammer65's Avatar
    Join Date
    Nov 2004
    Location
    Lincoln Nebraska
    Posts
    1,160
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You might need a database if that is where you want the information to go, but for the functionality you want, a database is not needed.

    Most multipage forms store each page submission in a session variable. When you get to the last submission, you can check if the checkbox for your agreement was checked. If it was, then process the input from the session and insert the appropriate values into the database (or email or pdf, etc.). If not send them back to the agreement.

    On each submission do this..

    PHP Code:
    // $step would be a number
    // indicating the step in the process
    $_SESSION['form_data'][$step] = $_POST
    Each page of submissions is now in an array element in the 'form_data' session variable.

    i won't write a full multipage form system for you here but that is the basics of how it can be done.

  4. #4
    SitePoint Zealot AVdes's Avatar
    Join Date
    Jun 2005
    Location
    GA
    Posts
    106
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No that's all the help I need. Thank you for pointing me in the right direction.
    CSS Club mantra; "I hate IE6, I hate IE6, I hate IE6".
    http://www.avdes.com


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
  •