Confusing POST behavior -- doing it twice?
- From: "Shelly" <sheldonlg.news@xxxxxxxxxxxxxxxx>
- Date: Mon, 01 Aug 2005 13:44:48 GMT
(posted previously on comp.lang.php but no response received. Cross-posted
in the dreamweaver forum)
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") {
---Do a bunch of stuff---
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: junk
- Re: Confusing POST behavior -- doing it twice?
- From: JDS
- Re: Confusing POST behavior -- doing it twice?
- From: DXTrim
- Re: Confusing POST behavior -- doing it twice?
- From: Erwin Moller
- Re: Confusing POST behavior -- doing it twice?
- Prev by Date: Handling data returned by mysql_fetch_row()
- Next by Date: Looking for a PHP PIN Number generator
- Previous by thread: Handling data returned by mysql_fetch_row()
- Next by thread: Re: Confusing POST behavior -- doing it twice?
- Index(es):
Relevant Pages
|