I have a slight problem here with my PHP page. I have difficulties getting the filled in data in a database.
Let me show you the code of the index;
<form action="aanmelden.php" method="post">
Naam: <input type="text" name="naam"><br>
Achternaam: <input type="text" name="achternaam"><br>
<input type="submit">
</form>
<php
$nm = $_POST['naam;];
$anm = $_POST['achternaam'];
?>
Now I thought I had obtained the variabled and sent to the 'aanmelden.php' file. The contents of the aanmelden.php file are:
<?php
$nm = $_GET['naam'];
$anm = $_GET['achternaam'];
$connect = mysql_connect('localhost', 'root', 'usbw');
mysql_select_db ('kantine');
$sql = "INSERT into kantine (naam, achternaam)
VALUES ('$nm', '$anm')";
$res = mysql_query($sql);
mysql_close ($connect); ?>
Looks all quite good to me, but when I press the submit button I get the following errors.
Notice: Undefined index: naam in I:\USBWebserver v8.6\root\aanmelden.php on line 2
Notice: Undefined index: achternaam in I:\USBWebserver v8.6\root\aanmelden.php on line 3
Please help me out if you can.
Regards,
Demiën