I have this error again:
Notice: Undefined index: IDNUMBER in E:\wamp\www\PHP\create.php on line 5
Here is my code:
<?php
include 'E:\wamp\www\PHP\connection.php';
$IDNUMBER = $_POST['IDNUMBER'];
$LNAME = $_POST['LNAME'];
$FNAME = $_POST['FNAME'];
$MNAME = $_POST['MNAME'];
$GRADEYR = $_POST['GRADEYR'];
$ADDRESS = $_POST['ADDRESS'];
if(!$_POST['submit']) {
echo "please fill out the form";
header('E:\wamp\www\PHP\main.php');
} else {
mysql_query("INSERT INTO students(`IDNUMBER`,`LNAME`,`FNAME`,`MNAME`,`GRADEYR`,`ADDRESS`)
VALUES (NULL, '$IDNUMBER', '$LNAME', '$FNAME', '$MNAME', '$GRADEYR', '$ADDRESS')") or die(mysql_error());
echo "User has been added!";
header('E:\wamp\www\PHP\main.php');
} ?>
Here is my main.php:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<?php
include 'E:\wamp\www\PHP\connection.php';
$query = "SELECT * FROM students";
$result = mysql_query($query);
while($students = mysql_fetch_array($result)) {
echo "<h3>".$students['LNAME'] ."</H3>";
}
?>
<h1>Create A user</h1>
<form action="create.php" method="post">
Idnumber:<input type="text" name="LName" value="" />
LastName:<input type="text" name="LName" value="" />
Firstname:<input type="text" name="FName" value="" />
Middlename:<input type="text" name="MName" value="" />
GradeOrYear:<input type="text" name="GradeOrYear" value="" />
Address:<input type="text" name="Address" value="" />
<br/>
<input type="submit" name="Submit" value="" />
</form>
<body>
</body>
</html>
And my connection.php:
<?php
$dbhost = 'localhost';
$dbuser= 'root';
$dbpass= '';
$dbname = 'koro';
$conn =mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname);
?>
*Where am I supposed to define the undefined in here?