[PHP-DB] session variables across several pages
First, forgive me if this seems to be cross post -- but it does involve both PHP and MySQL. My client requirements are: From their website, they display a list of classes. On registering for a class, the user is sent to a secure page that is hosted on a different secured server that does not have access to the client's MySQL database. I pass in the class info so the registration form can display Registering for class $titlebr$start_datebr$cost The form then gathers name, address, etc including credit card info. On submitting the form, the data is processed and a PGP email is sent out to the registar. Then a thank you page is displayed and the user is forwarded back to the main site, where a second page is displayed allowing for either download of class materials or to return to the class list. This page is where I post the necessary info into the MySQL database. So my dilemma -- I want to use session_register to capture the field info from the registration form and then read it back out on the website thank you page. I have session_start(); session_register(start_date); session_register(end_date); session_register(section); session_register(class); session_register(title); session_register(class_id); session_register(register_id); session_register(name); session_register(employer); session_register(e_address); session_register(e_city); session_register(e_state); session_register(e_zip); at the beginning of the form page (select_class.php) and the thank you page on their website (thanks.php) where I post the info to MySQL. The form includes inputs such as tdpbName:/b/p/td td colspan=3 input type=text name=name maxlength=100 size=60 value=? echo($name); ? /td What happens is that old data shows up for name, and address (the only fields I have tested so far) regardless of what I enter in the form. I was under the impression that a registered variable is updated once the page is processed. If I am calling the same page (select_class.php) to process the form, does the data get reverted somehow? The data just doesn't seem to get updated to the form inputs. What might I be missing? Thanks in advance Terry Romine Web Developer JumpInteractive.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] session variables across several pages
You need to look up $HTTP_SESSION_VARS['name'] - that's how to change the variables when they are already set.. i think most people have this problem when they first use sessions! -Original Message- From: Terry Romine [mailto:[EMAIL PROTECTED]] Sent: 15 May 2002 15:49 To: [EMAIL PROTECTED] Subject: [PHP-DB] session variables across several pages First, forgive me if this seems to be cross post -- but it does involve both PHP and MySQL. My client requirements are: From their website, they display a list of classes. On registering for a class, the user is sent to a secure page that is hosted on a different secured server that does not have access to the client's MySQL database. I pass in the class info so the registration form can display Registering for class $titlebr$start_datebr$cost The form then gathers name, address, etc including credit card info. On submitting the form, the data is processed and a PGP email is sent out to the registar. Then a thank you page is displayed and the user is forwarded back to the main site, where a second page is displayed allowing for either download of class materials or to return to the class list. This page is where I post the necessary info into the MySQL database. So my dilemma -- I want to use session_register to capture the field info from the registration form and then read it back out on the website thank you page. I have session_start(); session_register(start_date); session_register(end_date); session_register(section); session_register(class); session_register(title); session_register(class_id); session_register(register_id); session_register(name); session_register(employer); session_register(e_address); session_register(e_city); session_register(e_state); session_register(e_zip); at the beginning of the form page (select_class.php) and the thank you page on their website (thanks.php) where I post the info to MySQL. The form includes inputs such as tdpbName:/b/p/td td colspan=3 input type=text name=name maxlength=100 size=60 value=? echo($name); ? /td What happens is that old data shows up for name, and address (the only fields I have tested so far) regardless of what I enter in the form. I was under the impression that a registered variable is updated once the page is processed. If I am calling the same page (select_class.php) to process the form, does the data get reverted somehow? The data just doesn't seem to get updated to the form inputs. What might I be missing? Thanks in advance Terry Romine Web Developer JumpInteractive.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] session variables across several pages
I believe you.. I added $HTTP_SESSION_VARS['e_address'] = $e_address; in my process form code and it's still not updating the var. snippit from select_class.php where I have reference to $e_address: session_register(e_address); ... switch($doAction) { case Save Information: // save data in cookies $HTTP_SESSION_VARS['e_address'] = $e_address; die($e_address); ... form name='myForm' method='POST' action='select_class.php' enctype='multipart/form-data' tr tdpbEmployer Address:/b/p/td td colspan=3 input type=text name=e_address maxlength=100 size=60 value=? echo($e_address); ? /td /tr input type='submit' name='doAction' value='Save Information' ... entering any new data does not replace the old data as the die($e_address) shows. Whatsupwiththat??? On Wednesday, May 15, 2002, at 09:57 AM, matt stewart wrote: You need to look up $HTTP_SESSION_VARS['name'] - that's how to change the variables when they are already set.. i think most people have this problem when they first use sessions! Terry Romine Web Developer JumpInteractive.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] session variables across several pages
This is freaky. If I change the form method='get' I can see the e_address coming in correctly, but it gets changed back to old value -- by the session_register('e_address')?? should I have something along the line of if(!$e_address) register_session('e_address'); ??? On Wednesday, May 15, 2002, at 09:57 AM, matt stewart wrote: You need to look up $HTTP_SESSION_VARS['name'] - that's how to change the variables when they are already set.. i think most people have this problem when they first use sessions! Terry Romine Web Developer JumpInteractive.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] session variables across several pages
i would consider trying changing the variable names - so the field on the form would be called address, therefore the variable passed through would be $address, and then have the session variable called sess_address or something like that, and then do $HTTP_SESSION_VARS['sess_address']=$address; see if that makes any difference? -Original Message- From: Terry Romine [mailto:[EMAIL PROTECTED]] Sent: 15 May 2002 16:40 To: matt stewart Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] session variables across several pages This is freaky. If I change the form method='get' I can see the e_address coming in correctly, but it gets changed back to old value -- by the session_register('e_address')?? should I have something along the line of if(!$e_address) register_session('e_address'); ??? On Wednesday, May 15, 2002, at 09:57 AM, matt stewart wrote: You need to look up $HTTP_SESSION_VARS['name'] - that's how to change the variables when they are already set.. i think most people have this problem when they first use sessions! Terry Romine Web Developer JumpInteractive.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] session variables across several pages
huh.. seems to work, now. I do the following: session_start(); session_register(form_data); if($doAction) { switch($doAction) { case Save Information: // save data in cookies $HTTP_SESSION_VARS['form_data'] = array($name,$employer,$e_address); ... and on the thanks page: session_start(); session_register(form_data); list($name,$employer,$e_address) = $form_data; and it displays the correct data now. S the trick seems to be to not use the same var names. Ok. I got it. Thanks!! On Wednesday, May 15, 2002, at 11:01 AM, matt stewart wrote: don't think you can have an array as a session variable, you'd have to set it as character delimited string or something. Terry Romine Web Developer JumpInteractive.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php