multiple operators

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
fariquzeli
Forum Contributor
Posts: 144
Joined: Mon Jun 24, 2002 9:16 am
Location: Chicago
Contact:

multiple operators

Post by fariquzeli »

I'm not sure what the exact command is, but I want the designated field to be a number between 1 and 10, so it can't be over 10, nor can it be less than or equal to 0, here is what I have:

Code: Select all

if (strln($teaching_importance >10 or <=0)) &#123;
	$error .="You must enter a value between 1 and 10 for teaching importance.<br>";
	)


is the "or" statement the way to go abotu this or do I have to do something else? and should I have parenthesis all after the 0 like i do or like this

Code: Select all

if (strln($teaching_importance) >10 or <=0) (
                $error .="You must enter a value between 1 and 10 for teaching importance.<br>";
                )
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Try,

Code: Select all

if ($teaching_importance > 10 || $teaching_importance <= 0) &#123; 
   $error .="You must enter a value between 1 and 10 for teaching importance.<br>"; 
&#125;
Mac
fariquzeli
Forum Contributor
Posts: 144
Joined: Mon Jun 24, 2002 9:16 am
Location: Chicago
Contact:

Post by fariquzeli »

thanks a bunch.
Post Reply