August 21st, 1999, 04:54 PM
I have a an user registration database. Instead of having all the 60 fields in one form, I wanted to do it in 3 forms.
Form1 - for user information
Form2 - for company information
Form3 - for userid password.
The logic of the form should be that the user cannot fill Form3 without completing Form2 and Form1 etc after data validation(no space in last-name, zipcode, phone, email).When the user in Form3, and wish to change Form1 field it should be possible.
Can some one give me what technicque (cookie or Global variables etcO) is appropriate for this..
August 22nd, 1999, 08:18 AM
3 makes it a bit tricky since you want to be able to allow editing. The best solution I can see is to create a table for temporary storage. When you process the first form and after validation store those entries in the table. Same for 2. Then with the third after validation you can pull all the info from the previous 2 forms and put it all in your perm table. The temp table should contain a unique id that can be passed to each form. If the id is set your script can pull the previously stored info from the temp table and include it in the form as HTML input "value"s.
August 25th, 1999, 11:51 AM
You could also pass all the variables as hidden fields in the HTML code, then actually make the mysql query after the 3rd form. So if they don't complete all 3 forms nothing gets stored in any table. However, depending on the forms that can get tricky and pretty ugly.
August 25th, 1999, 03:26 PM
This is true, but again, it would be very, very ugly since he wants to allow editing of the previous changes, so you'd have to pass all those variables back to the beginning. Really, bad would be if the user is at the third page and wants to change the first. You'd have to carry all the variables for page 2 and 3 to 1 then back. YUCK.
Since he said he had a DB available I'd use that and let each form only worry about itself. Check a session id, check the table to see if it has info already stored and generate the form using the data from the table to auto-populate the form. Bingo! No muss, no fuss.
If I didn't have a DB available I probably wouldn't even tackle this. If I HAD to do it, I'd at least use a flat file.
August 30th, 1999, 02:21 PM
You would use PHP to get all variables from the preceeding page using :
while ( list( $key, $val )=each($HTTP_POST_VARS) )
and auto create the hidden fields in the forms, minimising the work.
This would work in reverse as you could look at the fields and repopulate the html form elements.
No database, very quick and relatively easy.