Re: checkbox
| From: | Folke Ashberg | Date: | Sat, 25 Nov 2000 20:35:57 +0000 |
| Subject: | Re: checkbox | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-27174@lists.php.net to get a copy of this message | ||
Hi!
you can check checkboxes with an "checked"
<input type="checkbox" name="terms"
value="<?php echo $row["frontpage"]?>"
<?php if (your_condition) print " checked"?>
>
--
Folke Ashberg
Stage Internet Services GmbH
Technical Development
folke@fanstage.de
folke@fanstage.de | Tel: +49 89 454591-77 | Fax: +49 89 454591-71
Kreillerstr. 21 | 81673 Munich | Germany | www.fanstage.de
On Sat, 25 Nov 2000, Richard Kurth wrote:
>
> I know this should be simple to figure out but I am stuck.
> I have three check boxes on a form all for different things.
> When I check them or don't check them they add ether yes or no to
> the database field corresponding to them. This is what I want them
> to do. My problem is when I pull the data back in to a form for
> update or viewing. I can not figure out how to make the check boxes be
> checked if the value is yes.
>
> <?php
> $query = "SELECT * FROM pcustomers WHERE id = $id";
> $result=mysql_db_query($dbName,$query);
> $row = mysql_fetch_array($result);
> mysql_free_result($result);
>
> ?>
>
> <input type="checkbox" name="terms" value="<?php echo
$row["frontpage"] ?>">
> <input type="checkbox" name="terms" value="<?php echo
$row["terms"] ?>">
> <input type="checkbox" name="wantdatabase" value="<?php echo
$row["wantdatabase"] ?>">
>
>
>
>