Re: [PHP] Help with session variables
Instead of register, set it up like a normal variable. Here's an examlple going by your code: Page1. session_start(); $HTTP_SESSION_VARS['step'] = 1; header("Location: page_A.php"); Page A session_start(); $HTTP_SESSION_VARS['step'] = 2; header("Location: page_B.php"); Page B. session_start(); echo $HTTP_SESSION_VARS['step']; // You can echo it out straight, don't need to extract it Hope it works! - Original Message - From: "Manuel Ochoa" <[EMAIL PROTECTED]> To: "PHP General" <[EMAIL PROTECTED]> Sent: Wednesday, December 04, 2002 1:12 AM Subject: [PHP] Help with session variables > > I'm running PHP 4.3 on a Windows .net server with Apache 2. Please look at the following code as I cannot figure out what I'm doing wrong. > > Page1. > session_start(); > session_register("step"); > $step=1; > header("location: page_A.php"); > > Page_A. > session_start(); > extract($_SESSION); > $step=2; > header("location: page_B.php"); > > Page_B. > session_start(); > extract($_SESSION); > print("$step"); > > Output is always "1". I thought that session variables were global? What am I doing wrong? > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with session variables
On Wednesday 04 December 2002 14:12, Manuel Ochoa wrote: > I'm running PHP 4.3 on a Windows .net server with Apache 2. Please look at > the following code as I cannot figure out what I'm doing wrong. > > Page1. > session_start(); > session_register("step"); > $step=1; > header("location: page_A.php"); > > Page_A. > session_start(); > extract($_SESSION); > $step=2; > header("location: page_B.php"); > > Page_B. > session_start(); > extract($_SESSION); > print("$step"); > > Output is always "1". I thought that session variables were global? What am > I doing wrong? If register_globals is disabled then you DO NOT use the session_register(), session_unregister() functions. You set them directly using: $_SESSION['step'] = 2 You remove them using: unset($_SESSION['step']) If register_globals is enabled THEN you use the session_register(), session_unregister() functions. In which case in your examples above, the use of extract($_SESSION) is meaningless, and you need to session_register('step'), then $step = 2. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* You have taken yourself too seriously. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help with session variables
I'm running PHP 4.3 on a Windows .net server with Apache 2. Please look at the following code as I cannot figure out what I'm doing wrong. Page1. session_start(); session_register("step"); $step=1; header("location: page_A.php"); Page_A. session_start(); extract($_SESSION); $step=2; header("location: page_B.php"); Page_B. session_start(); extract($_SESSION); print("$step"); Output is always "1". I thought that session variables were global? What am I doing wrong?
[PHP] help with session variables
"; } include ('./footer.php'); ?> What i need is to declare the arrays $names and $prices And select the prodid as key and the title as val how can I do this? I tried "select prodid as key, title as val but that doesnt work. thx for any help -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php