检查两个字符串是否为空不起作用

I have a conditional if check on a webform on which ajax (and php) is doing the submit work.

if(empty($name) or empty($message))
{
do something
}

The above is working if one of the 2 strings is empty.I want to add to the above

  or (empty($name) and empty($message))

for checking if both strings are empty but in someway its not working!I want to make sure all 3 senarios are covered,Name empty or Message empty or both empty. Any ideas?

This will check that both $name and $message is not blank, than true

if($name != '' &&  $message != '') {
  //Do something
}

If you use this, this will check if any 1 field is empty than the condition is true

if($name == '' || $message == '') {
  //Do something
}

If you use this, this will be true if both are empty

if($name == '' && $message == '') {
  //Do something
}

Replace "or" with "||". Example:

if (empty($name) || empty($message))
{
    // Do something
}

or means "If either condition is true", not "If exactly one condition is true".

The code you have already covers your requirement.