PDA

View Full Version : Problem - PHP comparing 2 variables strings ..how to ?


jesica
07-05-2008, 02:49 PM
Hello everybody,

Am trying to compare 2 variables of strings that are taking data from an input form as follow :

if($name == $surname){
die('Name and Sourname can not be the same !');
}
if(strlen($name) < 4) {
die ('Your name name must have more than 4 numbers !');
}


then, as you can see after the first if, it must follow an other if that oen with strlen, as you can see.

The problem is that then simply the if($name == $surname) dosent work, i mean it dosent control for the the equality of name and surname and the form is procesing forward without to check if the name and surname is same and die() as i want to ..

...
How can i fix this comparision so to work ..?
i have stuck over here, please i need some of your help :confused: :(

thanks in advance
waiting for your answers .. :thumbsup:

Fumigator
07-05-2008, 04:20 PM
Use trim() to strip white space from the variables.