I am trying to create my own error notification and redirect page in php.
A user will submit a form, then my code will search for unexpected vaules in the page and give back an error message telling the user what to do and redirect them to the original form.
[php]function sendBackMsg ($vasr) {
$sendBackCheck = 1;
$sendBackMessage = $sendBackMessage + “
” + $vasr;
}[/php]
This is the code that I’m using to notify that there is an error and that the user needs to be redirected, and also adding an error message with it.
$SendBackCheck is set to 0 at the top of the php document. After sendBackMsg does its work, it is set to one.
HOWEVER when I check the variable at the end it is reset to 0 somehow…
[php]if ( $sendBackCheck == 1)
{
echo $sendBackMessage;
header(‘Location: error.php’);
exit;
}
[/php]
^it never is 1…
I know sendBackMsg is working correctly because if i put echo $sendBackCheck in the function, it shows that $sendBackCheck has been set to 1. But at the end when i check it in a if statement, $sendBackCheck is always set to 0, even though the only place where I set it to 0 is at the top of the php code.