Page 1 of 1

multiple operators

Posted: Thu Jun 27, 2002 10:54 am
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>";
                )

Posted: Thu Jun 27, 2002 11:09 am
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

Posted: Thu Jun 27, 2002 11:37 am
by fariquzeli
thanks a bunch.