Re: Confusing POST behavior -- doing it twice?
- From: "DXTrim" <dXtrim@xxxxxxxxx>
- Date: Mon, 1 Aug 2005 16:19:00 +0200
Hi Shelly,
Please include an else:
// 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");
}else {
header("Location: anotherSite.php");
}
Let me know how you do.
Cheers,
DXTrim
"Shelly" <sheldonlg.news@xxxxxxxxxxxxxxxx> wrote in message
news:kHpHe.10824$8y3.5602@xxxxxxxxxxxxxxxxxxxxxxx
> (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
>
>
.
- References:
- Confusing POST behavior -- doing it twice?
- From: Shelly
- Confusing POST behavior -- doing it twice?
- Prev by Date: Re: Short query question (Where clause ..)
- 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
|