Re: HELP TO VALIDATE CHECKBOXES
| From: | Bogdan Stancescu | Date: | Fri, 21 Dec 2001 14:46:27 +0000 |
| Subject: | Re: HELP TO VALIDATE CHECKBOXES | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-78471@lists.php.net to get a copy of this message | ||
Ummm, though of this after I sent the e-mail: you may even perform the line after list($checked)...
with an if in the query and skip the line altogether. But that may be a little too much... :-)
Bogdan
Bogdan Stancescu wrote:
> while ($row = mysql_fetch_array($result))
> {
> echo $row["name"];
> list($checked)=mysql_fetch_row(mysql_query("select user_id from User_Category where
> user_id='$current_user' and
> category_id='".$row["category_id"]."'"));
> $checked=$checked?" checked":"";
> echo '<input type="checkbox" name="cat[]"
> value='.$row["category_id"].'$checked>';
> }