Re: dynamically fill list box
| From: | Jason Wong | Date: | Thu, 14 Mar 2002 20:12:06 +0000 |
| Subject: | Re: dynamically fill list box | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-88567@lists.php.net to get a copy of this message | ||
On Friday 15 March 2002 03:11, you wrote:
> Sorry....... The error I get on members.php page is
> "if ( == paid)" is printed if 'paid' is selected
> or "if ($paid == no)" is printed if 'not paid' is selected
> from this piece of code
> print "<tr><td class=LabelColumn>Paid:</td><td
> class=TextColumn><select
> name='paid' value='$row->paid'>
> <option value='if ($paid == paid)'>paid</option>
> <option value='if ($paid == no)'>not paid</option>
> </select></td></tr>";
>
1) You're nesting php code within html within php!
2) <select> tags don't have a value attribute.
Try:
if ($paid == 'paid') { $PAID_CHK = "CHECKED"; }
if ($paid == 'no') { $UNPAID_CHK = "CHECKED"; }
print "<tr><td class=LabelColumn>Paid:</td><td
class=TextColumn><select
name='paid'>
<option value='paid' $PAID_CHK>paid</option>
<option value='no' $UNPAID_CHK>not paid</option>
</select></td></tr>";
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
/*
Nothing will dispel enthusiasm like a small admission fee.
-- Kim Hubbard
*/