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';

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'
}

You beauty, that's the badger!

Thanks ever so much.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.