View Full Version : Continuous forms
11-25-2006, 08:59 PM
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.
11-25-2006, 09:33 PM
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.
11-26-2006, 03:00 AM
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.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.