Hi all,
I'm trying to make a form where you fill in a titel, and when you click on submit it stores it in the MySQL database, but I can't get it to work. It processes the entire document with an error, and stores an empty record in the database. Here is my code:
<?PHP
include("./include/header_inc.php"
;
include("./include/connection_inc.php"
;
IF ($HTTP_POST_VARS['actie'] = 'insert')
{
$titel = $HTTP_POST_VARS['titel'];
$SQL = "INSERT INTO tbl_dvd (titel) VALUES ('$titel')";
$query_result = mysql_query($SQL,$strconnstring);
echo mysql_error();
}
ELSE
{
print "<FORM name = toevoegen ACTION=dvd_toevoegen.php?actie=insert METHOD=post>";
print "<TABLE border = 1>";
print "<TR>";
print " <TD><input type=text name=titel size=40></TD>";
print " <TD><input type=submit name=submit value=Submit></TD>";
print "</TR>";
print "</TABLE>";
print "</FORM>";
}
include("./include/footer_inc.php"
;
?>
The error is:
Undefined index: titel in c:\program files\apache\htdocs\dvd_toevoegen.php on line 8
Does anybody have an idea?
Thanx.
I'm trying to make a form where you fill in a titel, and when you click on submit it stores it in the MySQL database, but I can't get it to work. It processes the entire document with an error, and stores an empty record in the database. Here is my code:
<?PHP
include("./include/header_inc.php"

include("./include/connection_inc.php"

IF ($HTTP_POST_VARS['actie'] = 'insert')
{
$titel = $HTTP_POST_VARS['titel'];
$SQL = "INSERT INTO tbl_dvd (titel) VALUES ('$titel')";
$query_result = mysql_query($SQL,$strconnstring);
echo mysql_error();
}
ELSE
{
print "<FORM name = toevoegen ACTION=dvd_toevoegen.php?actie=insert METHOD=post>";
print "<TABLE border = 1>";
print "<TR>";
print " <TD><input type=text name=titel size=40></TD>";
print " <TD><input type=submit name=submit value=Submit></TD>";
print "</TR>";
print "</TABLE>";
print "</FORM>";
}
include("./include/footer_inc.php"

?>
The error is:
Undefined index: titel in c:\program files\apache\htdocs\dvd_toevoegen.php on line 8
Does anybody have an idea?
Thanx.