Posted by J.O. Aho on 03/09/06 13:19
Steve wrote:
> I have a form which sub,its two values which i have succesfully added
> together...its a kind of calculator.
>
> I have populated a drop down menu in with 1-10 and i am trying to make
> it so if its the first time they visit the page it only shows 1-10 in
> the drop down menu.
>
> but if they have already submitted two values becuase it reloads the
> same page on form submit i want the values they submitted to be the
> first items in the drop down menu.
>
> Heres the code i have:
>
> <?php
> if (isnull($number1))=false {
> echo "<option value='<?php echo $number1; ?>'
> selected='selected'>£<?php echo $number1; ?></option>";
> }
> ?>
>
> and heres the error:
>
> Parse error: parse error, unexpected '=' in
> /home/users/uks08258/html/stephena.co.uk/j4m/calc.php on line 23
>
> is there a not null i can use?
>
It's a major error on your syntax
if (isnull($number1))=false
it's as wrong as trying
($a=1)=2;
You should instead use a proper if-statment
if (!isnull($number1)) {
...
}
or
if (isnull($number1)=false) {
...
}
The first one is nicer IMHO.
//Aho
[Back to original message]
|