Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple If statement issue

Status
Not open for further replies.

PushCode

Programmer
Dec 17, 2003
573
US
I have a simple line of code that is checking the value of the password field from the submitted form.

This one works:
Code:
<?php
if ($_POST['password'] != 'abc01') {
   header("Location: tryagain.htm");
   exit;
}
?>

I need to change it so password is not equal to abc01 OR def01.

I thought this would work but it doesn't:
Code:
<?php
if (($_POST['password'] != 'abc01') || ($_POST['password'] != 'def01')) {
   header("Location: tryagain.htm");
   exit;
}
?>

Any ideas?
 
change || to &&

you just have the logic backwards.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top