LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 10-13-2004, 01:32 AM   #1
appas
Member
 
Registered: Jul 2004
Posts: 72

Rep: Reputation: 15
php: session variables lost while redirecting


Dear All,
I have just started working in php,
I have a problem in redirecting session variables which is lost and not able to retrieve the session variable in the redirected page.
I am posting the code below., Could someone please help me to fix the problem. I am using php 4.3.9 and apache 2.0.52.
Thanks in advance.

CallHeader.php
Code:
<?php
global $clientMachine ;
$clientMachine = "appadurai" ;
session_register("clientMachine");
header("location:CheckGlobal.sgp");
?>
CheckGlobal.php
Code:
<?php
session_start();
echo "MACHINENAME $clientMachine";
?>
 
Old 10-13-2004, 07:27 AM   #2
eeyoree
Member
 
Registered: Aug 2004
Distribution: Slackware Ten
Posts: 34

Rep: Reputation: 15
since php > 4.20 register_globals = off on php.ini
this affect session_register()

PHP Code:
[b]one.php[/b]
<?php

session_start
();
$_SESSION['foo'] = "bar";


header("location: two.php");

?>


[b]two.php[/b]
<?php

session_start
();
echo 
$_SESSION['foo'];

?>

Last edited by eeyoree; 10-13-2004 at 07:31 AM.
 
Old 10-13-2004, 09:18 AM   #3
gizmo_thunder
Member
 
Registered: Apr 2004
Posts: 101

Rep: Reputation: 15
"header("location:CheckGlobal.sgp");"
check the file you are directing to..
I think thats' the problem
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Are PHP session variables held in memory when you leave a PHP site? Locura Programming 11 11-16-2008 08:37 PM
session variables not preserved when navigating thru links prabhatsoni Linux - Software 2 06-13-2005 01:15 AM
redirecting to index.php question jacksmash Programming 18 05-23-2005 05:41 PM
How to use session variables in perl ? taqs Programming 1 09-28-2004 06:12 PM
PHP session variables in a database rmanocha Programming 0 07-16-2004 04:18 AM


All times are GMT -5. The time now is 06:17 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration