Re: Confusing POST behavior -- doing it twice?



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


.



Relevant Pages

  • Re: List Box
    ... > I am trying for the first time to build a list box. ... > but get an error message when I run it ... Prev by Date: ...
    (microsoft.public.vc.mfc)
  • List Box
    ... I am trying for the first time to build a list box. ... using AddString and SetDlgItemText (I created a variable for this control), ... but get an error message when I run it ... Prev by Date: ...
    (microsoft.public.vc.mfc)
  • Re: NTSVC.OCX Help needed
    ... "When you use the Services snap-in to start a local service on a Microsoft ... The "cause" is stated as "This arbitrary time limit had been set with the ... error message and continue to check for the service to start. ... you must check the System event log for Service Control ...
    (microsoft.public.vb.general.discussion)
  • Microphone wont work
    ... Control Panel/Sounds and Audio Device/Voice/Testing sound Hardware. ... Windows error message "Windows cannot execute DpvSetup.exe, ... Sounds And Audio Devices icon (in the Sounds, Speech, And Audio Devices ... Now it's time to edit the Registry. ...
    (microsoft.public.windowsxp.hardware)
  • Re: Debit Card Purchase recording
    ... >> End Sub ... > I have this in the After Update Event of the control in the form ... despite the error message you're getting. ... Dirk Goldgar, MS Access MVP ...
    (microsoft.public.access.formscoding)