RE: [PHP] An if question
| From: | Ian Barnes | Date: | Tue, 04 May 2004 10:02:48 +0000 |
| Subject: | RE: [PHP] An if question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-185287@lists.php.net to get a copy of this message | ||
Hi,
This sorted out the problem
Thanks a million
Ian
> -----Original Message-----
> From: Marius Dascalu [mailto:mariusdascalu2003@yahoo.com]
> Sent: 04 May 2004 11:49 AM
> To: php-general@lists.php.net
> Cc: Ian Barnes
> Subject: Re: [PHP] An if question
>
>
> Hi,
>
> try that:
>
> if($add){
> if (!isset($rec) or $rec<0 or $rec>5) {
> $err='Invalid Level. Must be 0-5';
> } else {
> printsomestuffhere
> }
>
> HTH
>
> --- Ian Barnes <ian@cerebellum.za.net> wrote:
> > Hi,
> >
> > Here is a stupid question.
> >
> > I am busy taking the input from a field to write it
> > to a file. But the field
> > needs to be within a certain range (It must be from
> > and including 0 - 5).
> >
> > here is what I have:
> >
> > if($add){
> > if (!$rec or $rec>5) {
> > $err='Invalid Level. Must be 0-5';
> > } else {
> > printsomestuffhere
> > }
> >
> > What happens is that it doesnt allow anything
> > greater than 5 (Correct), but
> > it doesnt allow 0, it allowes 1,2,3,4&5 but not 0.
> > The field itself is set
> > to only allow 1 character so they cant put a - sign
> > in front
> >
> > Any idea how to allow 0 aswell? I have tried the
> > following aswell, also with
> > no success:
> >
> > if ($add) {
> > if (!$rec or $rec>5 or $rec<0) {
> > $err='Invalid Level. Must be 0.5';
> > }else{
> > printsomestuffhere
> > }
> >
> >
> >
> > Thanks for the help
> >
> > Ian
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Win a $20,000 Career Makeover at Yahoo! HotJobs
> http://hotjobs.sweepstakes.yahoo.com/careermakeover
>
>