正如标题所说。
表格或我的查询在欺骗我:(
它在我的数据库中输入了1,而不是我在表格中写的内容
这是我的表格
<form action="deleteupdate.php" method="post">
<div id="txtHint"></div>
<input type ="submit" name="submittype" value ="Delete">
<input type ="submit" name="submittype" value ="Update">
category: <input type="text" name="category" />
</form>
以及deleteupdate.php 中的查询
else if($_POST['submittype']=="Update"){
mysql_query("INSERT INTO `category`(`category`)
VALUES (category='$category')") ;
}
这不应该奏效吗?
应该是
mysql_query("INSERT INTO `category`(`category`)
VALUES ('". mysql_real_escape_string($_POST['category']) ."')") ;
$category在您的脚本中不存在
使用此代码:
else if($_POST['submittype']=="Update"){
mysql_query("INSERT INTO `category`(`category`)
VALUES ('". mysql_real_escape_string($_POST['category']) ."')") ;
}