well, so far i have this:
code:
<html>
<body>
<?php
$db = mysql_connect("127.0.0.1", "root");
mysql_select_db("movie_library",$db);
$_POST = array_map("mysql_escape_string",$_POST);
if (isset($_POST['dvd_title']))
{
//Form has been submitted
$dvd_title = $_POST['dvd_title'];
$dvd_director = $_POST['dvd_director'];
$dvd_classification = $_POST['dvd_classification'];
$dvd_actors = $_POST['dvd_actors'];
$dvd_genre = $_POST['dvd_genre'];
$dvd_year = $_POST['dvd_year'];
$dvd_length = $_POST['dvd_length'];
//insert to db
$sql = "INSERT into movies (dvd_title,dvd_director,dvd_classification,dvd_actors,dvd_genre,dvd_year,dvd_length) VALUES ('$dvd_title','$dvd_director','$dvd_classification','$dvd_actors','$dvd_genre','$dvd_year','$dvd_length')";
$result = mysql_query($db,$sql);
}
else{
?>
<form method="post" action="?">
DVD Title:<input type="Text" name="dvd_title"><br />
DVD Director:<input type="Text" name="dvd_director"><br />
DVD Classification:<input type="Text" name="dvd_classification"><br />
DVD Actors:<input type="Text" name="dvd_actors"><br />
DVD Genre:<input type="Text" name="dvd_genre"><br />
DVD Year:<input type="Text" name="dvd_year"><br />
DVD Length:<input type="Text" name="dvd_length"><br />
<input type="Submit" name="submit" value="Sumbit">
<?php
}
mysql_close($db);
?>
</body>
</html>
when i enter the data, the page goes blank (which im pretty sure its meant to), but the data isnt entered into the MySQL database.
I've asked -dt- on MSN and he couldn't find an error, so its probably someone hugely obvious, or something frustratingly small.