Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Nov 2006
    Thanked 0 Times in 0 Posts

    Continuous forms

    I am trying to create a form that when submitted will then route to another form asking form more information. My questions is how shoudl those forms be linked? i.e. Form 1 asks for and id number, first name, and last name, the user clicks submit and the second form asks for an address. The address is saved in a separate table in the database but uses the same id number without asking for it.

  2. #2
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Denver, Colorado USA
    Thanked 419 Times in 410 Posts
    If you only have a small amount of data that needs to be passed between pages, using a hidden field in the form is a popular method. If you have a large amount of data, this should be kept on the server and passed between pages in session variables.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  3. #3
    Master Coder
    Join Date
    Jun 2003
    Cottage Grove, Minnesota
    Thanked 1,131 Times in 1,122 Posts
    With PHP, the first form has the name of the second form in the spot
    for action: <form action="script2.php" method="post">

    On the second script, you grab the variables from the first form.

    Then display the next form.

    That 2nd form can call another script or you can call the final
    PHP script that processes your form(s).

    With PHP, variables are global, so as you move from script to script,
    those variables ($name, $id, etc) will follow along. No need to send
    them hidden or re-define them.


Posting Permissions

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