hi,
i am a total newbie in PHP en SQL. I have read a tutorial for a simple way to put in some data with a form.
When i try the following page i get the error messge of an undefined variable $submit. This looks logic to me because it isn't used before the if-question. But it is used in almost every example in the tutorial so i guess i am doing something wrong. I am waiting for a response of the publisher but is ther someone here who can help me?
Thanx
m0119975
<head>
<title>Page title</title>
</head>
<body>
<?php
if($submit)
{
$db=mysql_connect("localhost","root","");
mysql_select_db("films",$db);
$sql="INSERT INTO films(naam,aantal_cds,uitgeleend) VALUES($naam,$aantalcds,$uitgeleend)";
$result=mysql_query($sql);
echo"Waarden zijn toegevoegd";
}
else
{
?>
<form method="post" action="invullen.php">
Naam: <input type="Text" name="naam"><br>
Aantald CDs:<input type="text" name="aantalcds"><br>
Uitgeleend: <input type="Text" name="uitgeleend"><br>
<input type="submit" name="submit" value="toevoegen">
</form>
<?
}
?>
</body>
</html>