Jump to content

AND/OR


breadnbutter

Recommended Posts

I'm pretty new to PHP. I have done a few pages of code, and I'm now starting to get my head round it. However, I've looked on php.net and can't find the right syntax for an 'AND' or and 'OR' statement, a bit like in SQL. Is there such a thing?

Here is the context I want to use it in.

$areab = ($_POST['county']);

if ($areab == "Cambridgeshire")
{echo "E Anglia";} else {echo "";}

This is going to be part of a much more complex bit of code, but |I am using the echo to test to see if this state ment works. Which is does. But what I want to do is

$areab = ($_POST['county']);

if ($areab == ("Cambridgeshire") OR ("Suffolk") OR ("Norfolk")
{echo "E Anglia";} else {echo "";}

but this doesn't work, what is it that I should be doing?
Link to comment
https://forums.phpfreaks.com/topic/8713-andor/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.