我一直坐在这里30分钟,我找不到为什么这不起作用。
它是一个简单的mysql数据库表插入查询,但它没有添加数据,没有出现错误,所以我不知道为什么它不起作用,可能是我缺乏经验但我已经扫描了这段代码并且找不到任何错误。如果它很简单,那么我为浪费你的时间而道歉。
if($_POST['action'])
{
$key=$_POST['Key'];
$serial=$_POST['Serial'];
$version=$_POST['Version'];
$query="INSERT INTO List (ID, Key, Serial, Version) VALUES (NULL, '$key', '$serial', '$version')";
$rez=mysql_query($query);
header("Location: index.php");
}
?>
<style type="text/css">
<!--
form { font-family: "Courier New", Courier, mono}
body { font-family: "Times New Roman", Times, serif}
-->
</style>
<center>
<form action="" method="POST">
<h1> Add Key </h1>
<br>
Key:<br><input type="text" name="Key">
<br/>
Serial #:<br><input type="text" name="Serial"><br/>
<br/>
Version:<br> <select name ="Version">
<option value="2010">2010</option>
<option value="2013">2013</option>
<option value="2016">2016</option>
</select>
<br/>
<br/>
<br><input type="submit" name="action" value="Add Key">
<input type="reset" value="Reset">
</form>
<a href="index.php">Back</a>
</center>
</html>