checkboxes
| From: | luis at mecha dot barry dot edu | Date: | Tue, 26 Sep 2000 22:18:26 +0000 |
| Subject: | checkboxes | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-3107@lists.php.net to get a copy of this message | ||
Hello:
I have a series of checkboxes on a form that the user can edit...anyways, I want
to make the boxes to be checked if the value is in a table...the code works
below...more or less, because it gets the first one, but not others that may be
in the db...I know I am close but I can't seem to get it...
anyone see my stupid mistake please email me directly as I think my sub is a
little flaky...thanks
Luis
<?
//gets all checkboxes
while ($allpreqs = db_fetch_array($preqz)) {
//gets selected checkboxes
while ($chkdpreqs = db_fetch_array($prq)) {
$checked = '';
if ($allpreqs['preq_id'] == $chkdpreqs['preq_id']) {
$checked = 'CHECKED';
}
}
echo ("<INPUT TYPE=checkbox NAME=preq[]
VALUE=\"".$allpreqs['preq_id']."\"
".$checked.">".$allpreqs['prereq']."<BR>\n");
}
?>
---------------------------------------------
This message was sent using Mecha WebMail.