RE: [PHP] Sessions help...

From: Date: Thu, 15 May 2003 16:22:26 +0000
Subject: RE: [PHP] Sessions help...
Groups: php.general 
Request: Send a blank email to php-general+get-147725@lists.php.net to get a copy of this message
Can I assume that you have session_start and session_register at the very beginning of the page. Also, is each value of $r_name registered? I believe all variables in $_SESSION must be registered. If not, when you reload the page, the session variables you gave a value to will be empty. Robbert van Andel -----Original Message----- From: Dan Joseph [mailto:djoseph@duhq.us] Sent: Thursday, May 15, 2003 8:46 AM To: php-general@lists.php.net Subject: [PHP] Sessions help... Hi All, I have been working for 2 days on a simple script. I even find it hard to believe that I cannot figure this out, so I am turning to the community to try and find an answer. First, some code (all from the same script): $region = mysql_fetch_array ($template_res); foreach ($region as $name => $value) { $r_name = str_replace("_", "", $name); $tmpl->$r_name = $value; $_SESSION[$r_name] = $value; } This piece loads all the database variables that I pulled out into sessions. I am using: foreach ($_SESSION as $name => $value) { echo "$name => $value<br>"; } to see an output of what I just created. I get: 0 => NEVD region => NEVD 1 => Nevada Bell brandname => Nevada Bell 2 => SBC Nevada Bell sbcbrandname => SBC Nevada Bell 3 => nevbell imgbrand => nevbell 4 => http://www.nevadabell.com/ siteaddress => http://www.nevadabell.com/ 5 => Copyright_PrivacyPolicy/0,,113,00.html privacy1 => Copyright_PrivacyPolicy/0,,113,00.html 6 => Copyright_PrivacyPolicy/0,,114,00.html privacy2 => Copyright_PrivacyPolicy/0,,114,00.html 7 => C2002 Nevada Bell Telephone Company companylabel => C2002 Nevada Bell Telephone Company 8 => ebilllink => I do not know where the 0-8 items are from. I have 'session_start ();' at the top of each script. When I do a submit to go to step 2, it looses all the session values. Here is the code for submission: echo ' <form action=index.php> <input type=hidden name=step value=2> <input type=submit value=submit> </form> '; Simple html. I am completely stumped. I have been all over php.net, the archives, and phpbuilder.com. I cannot find any answer to what I am doing wrong. When I hit submit, it comes up, and $_SESSION is empty. Any advice will be greatly appreciated... Using Version 4.1.2... -Dan Joseph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#147725) next »