Rick Emery said:
> if ( $_POST['passwd'] != $db['password'] )
> {    header("Location: loginfailed.html"); exit;
> }
> ----- Original Message -----
> From: "Shams" <[EMAIL PROTECTED]>
> To: <>
> Sent: Tuesday, January 21, 2003 3:48 AM
> Subject: [PHP] $header = "Location:........" being ignored!
>
>
> Hi Group,
>
> I basically have some simple code such as:
>
> ==================================================
>
> if ( $_POST['passwd'] != $db['password']
> {    header("Location: loginfailed.html");
> }
>
> //else
>
> $header = "Location: success.html";
>
> ==================================================
>
> however, when I run this code, using a <FORM> to submit password,
> username, etc...... if the passwords do not match, the page is forwarded
> to
> success.html !
>
> Is there anything obvious that I am doing wrong?
>
> Thanks,
> Shams
>
> p.s. I don't want to use else{} because I have lots of if() checks!

Well, semantically not using an else there is causing your problem.  Using
the exit as above should work, but is not a very good practice.  Using the
else will allow the rest of the script to run, which might be nice, or
necessary.

If you have a lot of if statements consider using the case/switch construct.

-Peter



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to