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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.