Inconsistant Order of Execution...?
Posted: Mon Nov 19, 2007 2:10 pm
This isn't making sense to me at all... I'm trying to use session variables to display an error message, and then unset the variable.. The method works fine on 2 different login pages, but I'm trying to use the same procedure on a different form and it's unsetting the variable before the echo...
Here's my code:
processing page... ($msg is set on input length errors)
and then back to sign up page...
It's so simple that I can't understand why it's not working... and only on this page, the same code works fine elsewhere. If I remove the 'unset' line, it displays the message as expected. I've even tried assigning $_SESSION["msg"] to a new variable at the top of the page, and unsetting $_SESSION["msg"] at the bottom of the page. What the hell is going on?
Here's my code:
processing page... ($msg is set on input length errors)
Code: Select all
if($msg != "") {
$_SESSION["inputs"]=$inputs;
$_SESSION["msg"]=$msg;
header("location:/signup/");
}Code: Select all
<?
if(isset($_SESSION["msg"])) {
echo "<div class=\"error\">".$_SESSION["msg"]."</div>";
unset($_SESSION["msg"]);
}
?>