Forums

PHP

This topic is locked

Multipage form and sessions

Posted 27 Apr 2003 15:49:50
1
has voted
27 Apr 2003 15:49:50 Jen Huls posted:
<font face='Verdana'>I have a 7 page form that I plan to use as a RFP. I want to be able to pass the information from page to page and input the info into a database. Finally, on the last page I want to be able to display some of the information that was entered into the first page of the form (First & Last Name and email address).
<br>
<br>
Obviously, sessions are preferrable for me than a bunch of hidden fields. However, I am new to PHP and have searched for tutorials but am not finding exacty what I need.
<br>
<br>
What I want to know is how I would set up PHP to pass the info from page to page. So far I know that I have to put session_start () at the top of each page and I think in my form on page one I have to set the Action to the final page, worksheet7.php, tell it that it is a multi-part form/data and to Post the info.
<br>
<br>
I am missing the guts of this... can anyone help explain it to me - like I was a 2 year old? <img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle> Or point me to a good tutorial... I'm pretty certain with my limited knowledge it has something to do with session variables.</font id='Verdana'>

Jen H.
www.popstalin.com
"Nobody puts Baby in a corner!"

Replies

Replied 01 May 2003 03:43:44
01 May 2003 03:43:44 J.S. - UltraSuite replied:
Session variables, once set, are available on any page in that site. Check out my PHP_MySQL extensions if you like.

J.S.
www.ultrasuite.com/
Replied 07 May 2003 10:45:32
07 May 2003 10:45:32 Plamen Jelezov replied:
Hi!

You can get the job done very easy.
First, as in the DW's behaviour "Set Session to a Form element", you need to grab the value of one key form element. Lets say the 'User Name' form field and we name it '$usr_name'. I presume you have edited your php.ini with 'register_globals = on' and therefore I will use short global names instead of long.
After that start the session with session_start(); at the very beginning of each page you are going to use. Then set the session variable's value by writing the following:
$uid = $usr_name;
session_register("uid";

Now you already have a session registered with name like 'jhhh7866897687..." that contains key 'uid' with value whatever user writes. In the next files you use it by asking the PHP engine to give you back the value of '$uid'.
After you are done just destroy it by writing:
session_unset();
session_destroy();

That's all.
Hope this help!
If you have more questions don't hesitate to contact me at
brgds.
pj
Replied 12 Jul 2008 23:07:53
12 Jul 2008 23:07:53 Michael Stewart replied:
Thanks guys, this works perfectly...

Scott Randall
www.boomlogic.com

Reply to this topic