Hello, I'm stuck in my developing of a filmcatalogue-type db. I have 3 tables and 2 html-forms. The form for the films is working ok- it's based on text inputs.
BUT I can't get the form for "genres" to work; I want to use checkboxes with 11 genre/types, because a film must be specified with...say 3 attributes (e.g. drama, action, war...). I want the result to be boolean in the table (1 or 0, not null) and select the 1's in PHP to present it all in html. The third table is shared (filmID, title, genre).
- <?php
-
$con = mysql_connect("localhost","root","");
-
if (!$con)
-
{
-
die('Could not connect: ' . mysql_error());
-
}
-
-
mysql_select_db("filmarkiv", $con);
-
-
$sql="INSERT INTO genre_film (drama, thriller, action, dokumentär, kärlek, humor, krig, skräck, kriminalare, historia, politik)
-
VALUES
-
('$_POST[drama]','$_POST[thriller]','$_POST[action]','$_POST[dokumentär]','$_POST[kärlek]','$_POST[humor]','$_POST[krig]','$_POST[skräck]','$_POST[kriminalare]','$_POST[historia]','$_POST[politik]')";
-
if (!mysql_query($sql,$con))
-
{
-
die('Error: ' . mysql_error());
-
}
-
echo "1 film uppdaterad";
-
mysql_close($con)
-
?>
Grateful for help!