私は再びこのエラーがあります:
注意: 未定義のインデックス: E:\wamp\www\PHP\create.php の 5 行目の IDNUMBER
これが私のコードです:
<?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');
} ?>
ここに私の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>
そして私のconnection.php:
<?php
$dbhost = 'localhost';
$dbuser= 'root';
$dbpass= '';
$dbname = 'koro';
$conn =mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname);
?>
*ここで undefined をどこで定義すればよいですか?