$_SESSION Problem????
Posted: Mon Nov 20, 2006 10:50 pm
feyd | Please use
temp2.php
In the process, I firstly call out the file temp1.php. Then within the function test1(), i direct to the file temp2.php. After finishing runing the file temp2.php, it continues its process in file temp1.php, runing function test2(). Again the function test2() also directs to the file temp2.php. Suprisingly, here is the result::::
bb
It should be like this:
ab
So, why the result is "bb"?? It should be "ab"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Any explaination!!!!!!!!!!!!!!!!
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi all, I have problem with the $_SESSION variable.
Check this out:
temp1.phpCode: Select all
<?php
session_start();
funtion test1()
{
$_SESSION["temp"]="a";
//then direct to the file temp2.php
}
function test2()
{
$_SESSION["temp"]="b";
//then direct to file temp2.php
}
?>temp2.php
Code: Select all
<?php
session_start();
echo $SESSION["temp"];
?>In the process, I firstly call out the file temp1.php. Then within the function test1(), i direct to the file temp2.php. After finishing runing the file temp2.php, it continues its process in file temp1.php, runing function test2(). Again the function test2() also directs to the file temp2.php. Suprisingly, here is the result::::
bb
It should be like this:
ab
So, why the result is "bb"?? It should be "ab"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Any explaination!!!!!!!!!!!!!!!!
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]