0

Hi guys, I am trying to echo some output based on a variable in my PHP.

I can code an if statement to echo the output if the variable is not empty if (!$variable=='') but my problem comes if the variable returns the value "N/A". If it returns N/A I do not want the output to be printed.

So is there a way to say:

If $variable is not blank, but is also not "N/A"
echo 'output';

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by jumbla
0

i am not sure if this is what you are looking for:

if ( $variable !== '' && $variable !== 'N/A' ) {
  //put code here if the variable is not blank and not equal to 'n/a'
}
0

You beauty, that's the badger!

Thanks ever so much.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.