Link to home
Start Free TrialLog in
Avatar of aej1973
aej1973

asked on

Ckecking for empty strings in PHP

How do I check if a string variable is empty using PHP? My variable is $name. Presently, I have a statement that looks like this:
if ($name == "") {...} else {...}
but if I enter one or more blank spaces into $name, control passes to the else part. I want to block this and make sure the else part is carried out only if $name is not empty.
Thank you.
A
ASKER CERTIFIED SOLUTION
Avatar of snoyes_jw
snoyes_jw
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial