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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

strlen issue

Status
Not open for further replies.

tyrannus

MIS
Apr 6, 2006
115
US
I have a block of code that checks the variables of a form

Code:
 if(strlen($fname > 0) && strlen($lname > 0) && ereg("[0-9]{3}-[0-9]{3}-[0-9]{4}",$phone) && ($email == $email2)){
   registerUser($fname, $lname, $street, $city, $state, $zip, $phone, $phone2, $store, $email, $email2);
  }else{
   echo 'You have a problem''
  }

For some reason the strlen($fname) and strlen($lname) keep sending down to the else. I have data in the variables. I cannot figure out what the issue is.
 
for starters your comparisons are wrong:

Code:
 if(strlen([red]$fname > 0[/red]) && strlen([red]$lname > 0[/red]) && ...

Should be:

Code:
 if((strlen([red]$fname[blue])[/blue] > 0)[/red] && (strlen([red]$lname[blue])[/blue] > 0)[/red]&&

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top