Struggling to get the following code to work. The code works if I just put an individual table in SELECT FROM, but I can't get anything when I try and do INSERT INTO table and then substitute it in. I am a complete noob at this and I know in advance...I suck :>. Thanks in advance for any help.
<form method="post">
<input type="checkbox" name="table[]" value="A" checked="checked"/>A<br/>
<input type="checkbox" name="table[]" value="B"/>B<br/>
<input type="submit" name="Submit" value="Submit">
</form>
<?php
$con = mysql_connect("","","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("", $con);
//STEP 5
//initialize an array for the categories
$categories=array();
// check whether any categories have been selected"
$categories = implode(",",$_POST['table']);
print_r ($categories);
if(isset($_POST['table']))
{
foreach($_POST['table'] as $value)
{
$insert="INSERT INTO table (table) VALUES $categories";
mysql_query($insert);
}
echo $insert;
}
$query = "SELECT () FROM table"
?>