以下代码功能正常,我可以在数据库的表中添加一行。但是,当我运行它时,我会在页面上收到通知
注意:未定义的索引:在第49行的C:\ xampp \ htdocs \ PHP_RESUME_AD \ php \ ED_A.php中提交
我不确定为什么。
<html id="education" lang = "en-US">
<head>
<link rel="stylesheet" type="text/css" href="../css/index.css">
<meta charset = "UTF-8">
<title>Education</title>
<style type = "text/css">
table, th, td {border: 1px solid black};
</style>
</head>
<body>
<form method="post">
Enter your Class<input type="text" name="Class"><br>
Enter your Discipline<input type="text" name="Discipline"><br>
Enter your Description<input type="text" name="Description"><br>
Enter your Term<input type="text" name="Term"><br>
<input type="submit" name="submit" value="Save">
</form>
<style>
ul {
list-style-type: none;
margin: 0;
padding: 0;
}
li {
display: inline;
}
</style>
<body>
<ul
<li><a href="../html/welcome.html">Back to Home page</a></li>
<li><a href="../php/ED_D.php">Education </a></li>
<li><a href="../php/SK_D.php">Skills</a></li>
<li><a href="../php/SK_A.php">Skills Add</a></li>
<li><a href="../php/HB_D.php">Hobbies</a></li>
<li><a href="../php/HB_A.php">Hobbies Add</a></li>
<li><a href="../php/PWE_D.php">Work Experience</a></li>
<li><a href="../php/PWE_A.php">Work Experience Add </a></li>
<li><a href="../php/email.php">Contact Me!</a></li>
</ul>
</body>
</html>
<?php
if(!empty($_POST["submit"]=="Save"))
{
$Class = $_POST["Class"];
$Discipline = $_POST["Discipline"];
$Description = $_POST["Description"];
$Term = $_POST["Term"];
mysql_connect("localhost", "root", "HAPPY3");
mysql_select_db("cs266ad_db1");
$s="insert into education(Class,Discipline,Description,Term) values('".$Class."','".$Discipline."','".$Description."','".$Term."')";
mysql_query($s);
}
?>