Re: Confusing POST behavior -- doing it twice?
- From: "Shelly" <sheldonlg.news@xxxxxxxxxxxxxxxx>
- Date: Mon, 01 Aug 2005 14:38:40 GMT
Here is the corrected post. I made about 5 errors in typing this post the
first time that are not in the actual (full) code.
I am confused about what goes on with method POST. Here is an overview of a
my code, sketching it out:
<?php
if (isset($_POST['Submit']) && $_POST['Submit']=="Submit") {
if (isset($_SESSION['Error'])) {
unset($_SESSION['Error']);
}
if (strcmp($A, "any")) {
// Verify that a Zip code is numeric and is five digits
If (!is_numeric($_POST['zip']) || strlen($_POST['zip']) != 5) then
{
$_SESSION['Error'] = "an error description";
header("Location: thisSite.php");
}
}
}
header("Location: anotherSite.php");
?>
...... in the form description I have an
<?php if (isset(($_SESSION['Error'])) echo $_SESSION['Error']; ?>
(Note: The form is type POST).
So here is the problem:
1 - When I start, there is no error message.
2 - I deliberately put in a bad zip code and have a value other than "any"
in the A control and click to submit it.
3 - Instead of going back to thisSite.php and displaying the error message,
it goes to anotherSite.php.
4 - If I then hit the back arrow on the browser, it displays with the error
message on thisSite.php
It seems that
1 - on the submit it goes through the logic and sets the error.
2 - It then must be going through a second time, but this time taking on the
default setting of "any" for control A and so bypass the logic on the zip
code and so goes to anotherSite.php.
Please help me here.
Shelly
.
- Follow-Ups:
- Re: Confusing POST behavior -- doing it twice?
- From: Erwin Moller
- Re: Confusing POST behavior -- doing it twice?
- References:
- Confusing POST behavior -- doing it twice?
- From: Shelly
- Re: Confusing POST behavior -- doing it twice?
- From: Erwin Moller
- Re: Confusing POST behavior -- doing it twice?
- From: Shelly
- Confusing POST behavior -- doing it twice?
- Prev by Date: Re: Confusing POST behavior -- doing it twice?
- Next by Date: Re: Confusing POST behavior -- doing it twice?
- Previous by thread: Re: Confusing POST behavior -- doing it twice?
- Next by thread: Re: Confusing POST behavior -- doing it twice?
- Index(es):
Relevant Pages
|