Database requests to display checkboxes

Hi all,

I want to display the checkboxes checked or not checked. The following script is an idea of what I want only the array $category & $category2 would be datas from my database. I would like to query and fetch them with mysql_query etc but I can’t find the solution. I really need help!

Here is the code:

[php] $category = array(“art”, “fashion”, “charity” );
$category2 = array(“art”, “charity”, “painting”, “sport” );

			foreach ($category as $cate) 
			{
				if(in_array($cate,$category2) )
				{
					echo '<input name="cate[]" type="checkbox" value="$cate" checked="checked"> oui ';
				} 
				else
				{
					echo '<input name="cate[]" type="checkbox" value="$cate"> non';
				}
			}[/php]
Sponsor our Newsletter | Privacy Policy | Terms of Service