PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
hward
Forum Contributor
Posts: 107 Joined: Mon Apr 19, 2004 6:19 pm
Post
by hward » Mon Aug 02, 2004 3:18 pm
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
Draco_03
Forum Regular
Posts: 577 Joined: Fri Aug 15, 2003 12:25 pm
Location: Montreal, Canada
Post
by Draco_03 » Mon Aug 02, 2004 3:21 pm
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
}
hward
Forum Contributor
Posts: 107 Joined: Mon Apr 19, 2004 6:19 pm
Post
by hward » Mon Aug 02, 2004 3:24 pm
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 ==
Draco_03
Forum Regular
Posts: 577 Joined: Fri Aug 15, 2003 12:25 pm
Location: Montreal, Canada
Post
by Draco_03 » Mon Aug 02, 2004 3:26 pm
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....
hward
Forum Contributor
Posts: 107 Joined: Mon Apr 19, 2004 6:19 pm
Post
by hward » Mon Aug 02, 2004 3:27 pm
yea the first code is fine the second what what I am looking for though i think i will give that a try
hward
Forum Contributor
Posts: 107 Joined: Mon Apr 19, 2004 6:19 pm
Post
by hward » Mon Aug 02, 2004 3:32 pm
that was what I needed thank you
Draco_03
Forum Regular
Posts: 577 Joined: Fri Aug 15, 2003 12:25 pm
Location: Montreal, Canada
Post
by Draco_03 » Mon Aug 02, 2004 3:40 pm
your welcome
Joe
Forum Regular
Posts: 939 Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow
Post
by Joe » Mon Aug 02, 2004 4:34 pm
You can also use if (!$variable)