using "if" and "strlen()" or "empty()" in PHP

this should be simple, i think.

i need to determine if $sDancers does not contain data and not execute an email. if $sDancers does have data, then send the email.

this is what i have right now, which doesn't work.

could i use empty() instead?
$Zval  = 0;
	
	if (!strlen($sDancers) <> $Zval) {
		mail ($tomb, $subject1, $body1, $header); //email to mario
		}

Open in new window

ironpen45Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
mpete510Connect With a Mentor Commented:
Also, inequality in PHP is done with !=, not <>.
if (strlen($sDancers) != $Zval)

Open in new window

0
 
mpete510Commented:
I believe removing the ! from the if statement should fix your problem.
$Zval  = 0;
        
        if (strlen($sDancers) <> $Zval) {
                mail ($tomb, $subject1, $body1, $header); //email to mario
                }

Open in new window

0
 
ironpen45Author Commented:
that did it! thanks!
0
All Courses

From novice to tech pro — start learning today.