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 506 Times in 494 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.
    Finding out HOW to do something is called research, i.e. keep searching until you find the answer. After you attempt to do something and cannot solve a problem with it yourself, would be when you ask others for help.

  3. #3
    Supreme Master coder!
    Join Date
    Jun 2003
    Cottage Grove, Minnesota
    Thanked 1,168 Times in 1,159 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