Re: Random number Question
| From: | Joel Colombo | Date: | Thu, 18 Apr 2002 19:54:58 +0000 |
| Subject: | Re: Random number Question | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-93593@lists.php.net to get a copy of this message | ||
actually
if (intval($guess) == $number {
would be more acuate then the trim ( )
you would eliminate all alpha characters and floating points
saying it has to be a whole integer....
Joel
"Ralph Friedman" <ralph@friedman-net.com> wrote in message
news:VA.00000005.0285e606@friedman-net.com...
> In article <20020313035421.28517.qmail@pb1.pair.com>, Jennifer Downey
wrote:
>
> > <input type="text" size="3">
> > <INPUT TYPE="submit" VALUE="Submit my number"
> > NAME="guess">
> >
> you've got the "Name" attribute attached to the wrong INPUT element:
>
> <INPUT type="text" size="3" name="guess">
> <INPUT type="submit" value="Submit my number">
>
> > if($guess = = $number) {
> >
> incorrect syntax here. that should be:
> if ($guess == $number) {
>
> better would be:
>
> if (trim($guess) == $number {
>
> this will assure that there's no whitespace in $guess
>
> --
> Rgds
> Ralph
>
>