Page 1 of 1
if else question
Posted: Mon Aug 02, 2004 3:18 pm
by hward
Code: Select all
<?php
elseif ($password == $password2) {
Passwords didnt match;
}
?>
how can I change the == so that ifelse happens when the two passwords
don't match instead of when they do match
Posted: Mon Aug 02, 2004 3:21 pm
by Draco_03
I'm not sure as what you mean but here's my try
Code: Select all
if ($password == $password2){
//password works
}else{
//password didn't work
}
Posted: Mon Aug 02, 2004 3:24 pm
by hward
i mean is where == means if the are equal do the state ment is there a if they aren't equal referring to the ==
i am asking is there an oposite to ==
Posted: Mon Aug 02, 2004 3:26 pm
by Draco_03
Operator ! is what your looking for
Code: Select all
$password != $password2 //this means when password is different then password2
But my first code i gave you should work....
Posted: Mon Aug 02, 2004 3:27 pm
by hward
yea the first code is fine the second what what I am looking for though i think i will give that a try
Posted: Mon Aug 02, 2004 3:32 pm
by hward
that was what I needed thank you
Posted: Mon Aug 02, 2004 3:40 pm
by Draco_03
your welcome

Posted: Mon Aug 02, 2004 4:34 pm
by Joe
You can also use if (!$variable)