Hi everyone,
Please help me to understand the following...
What happens is when a.php is run, which redirects to b.php, b.php
shows nothing (should print "bla..."). It appears that doit() is run
in a.php which clears $SESSION['msg'] resulting in b.php getting a
blank $SESSION['msg'] (if I take out $_SESSION['msg'] = "" from the
doit() function b.php shows "bla..."). But how can that be?? doit()
should never run in a.php due to the redirect, right?? I'm working on
a unix server.
I'm deeply troubled by this and if someone could shed some light on
this I would truly appreciate it.
********* a.php *********
session_start();
require("c.php");
if (true) {
$msg = "bla...";
session_register("msg");
header("location: b.php");
}
doit();
********* b.php *********
<?
session_start();
require("c.php");
doit();
?>
********* c.php *********
<?
session_start();
function doit() {
print $SESSION['msg'];
$SESSION['msg'] = "";
}
?>