Here's the code for the form
Code: Select all
mysql_select_db("system", $con);
$result = mysql_query("SELECT * FROM destination");
while($row = mysql_fetch_array($result))
{
echo $row['destname'];
echo "<input type=\"checkbox\" name=\"" . $row['destname'] . "\" value=\"" . $row['destid'] . "\">";
echo "<br />";
}
mysql_close($con);
?>Code: Select all
while($row = mysql_fetch_array($result))
{
$currentdbdest = $row['destname'];
$currentpostdest = $_POST[$currentdbdest] + "";
echo $currentpostdest;
if ($currentpostdest != null){
echo $row['destname'];
mysql_query("INSERT INTO custdest (userid, destid) VALUES ('$userid', '$row[destid]')");
}
}