A month or so earler, i asked for help on php, forms ,etc.
Happy to announce, that I’ve setup the form. Works great. I get the results emailed, and added to an excel file. I have form validation working as well.
All is good, but now I have a new problem.
The survey is just too long for one page. It is basically 30 question, and I want to split it over 5-6 pages.
How do I do it. I’ve googled, and come up with different suggestions, like saving the results to a tmp file, using GET to store the results in the address bar, etc..
Can someone suggest the easiest method for a non-programmer like me ..?
nomaan, you’ll have to play around with this because it’d be hard to have a pre-built situation to your problem.. its fairly easy though.
1- start a session at the top of every page with session_start(); when this function is called php basically sets up a session id, if none already exists, or loads the old variables if the session is already started. If you want to enable sessions permanentaly, then in your php.ini file, session.autostart variable to 1. Also, you’ll have to turn trans id’s to 1, if cookies are turned off in the user’s browser .. session.use_trans_id = 1
so lets say your questions are numbered var1 - var30.. on the first page, you do the following:
$_SESSION’var1’] = … ;
$_SESSION’var2’] = … ;
…
this session array will be available on all following pages.
Also, php provides a session_register function, if you do not want to use the session array: PHP: Manual Quick Reference