【发布时间】:2016-07-07 13:50:12
【问题描述】:
当我单击提交按钮时,我的 <input> 值不会发布到我的数据库中。我找不到错误。请帮忙。
<?php
echo "<form action=Display.php method=post>";
echo "<td>" . $fiberexcel['Engineer9'] ." </td>";
echo "<td>" . $fiberexcel['AM10'] ." </td>";
echo "<td>" . "<input type=date name=A12 value=" . $fiberexcel['Quotation11'] ." </td>";
$A6 = date("Y-m-d");
$ExpectDateQuotation12 = strtotime($ReqDate4."+ 10 weekday");
echo "<td>" . date("Y-m-d",$ExpectDateQuotation12) . "</td>";
$ExpectDateQuotation12 = date("Y-m-d",$ExpectDateQuotation12);
$UpdateQuery = "UPDATE `fiberexcel` SET `ExpectDateQuotation12` =
'$ExpectDateQuotation12' WHERE `fiberexcel`.`SiteID0` = '$A1';";
mysqli_query($conn, $UpdateQuery);
echo "<td>" . "<input type=date name=A14 value=" . $fiberexcel['ApprovalJFSRequest13'] ." </td>";
?>
echo "<td>" . "<input type=hidden name=hidden value=" .$fiberexcel['SiteID0'] ." </td>";
//echo "</tr>";
echo "<td>" . "<input type=submit name=update value=update>". "</td>";
echo "</form>";
这是我的更新按钮发布功能:
if(isset($_POST['update'])){
$UpdateQuery = "UPDATE `fiber`.`fiberexcel` SET Quotation11='$_POST[A12]' , ApprovalJFSRequest13='$_POST[A14]' WHERE `fiberexcel`.`SiteID0`='$_POST[hidden]'";
mysqli_query($conn, $UpdateQuery);
};
【问题讨论】:
-
不要将原始帖子数据放入像
"UPDATE `fiber`.`fiberexcel` SET Quotation11='$_POST[A12]' , ApprovalJFSRequest13='$_POST[A14]' WHERE `fiberexcel`.`SiteID0`='$_POST[hidden]'"这样的sql语句中。这样容易出现sql注入。 -
即使我添加这个发布功能也不会发布到数据库 "UPDATE fiberexcel SET Quotation11='$_POST[A12]' , ApprovalJFSRequest13='$_POST[A14]' WHERE fiberexcel.SiteID0='$ _POST[隐藏]'"`.
-
并且不要在 PHP 中使用
`,而是使用'。 PHPMyAdmin 为您提供的查询不在 PHP 中工作 -
好的。我将 ` 更改为 ' 仍然无法正常工作:(
-
@JRsz 您在此脚本中指的是哪些反引号? php可以执行反引号列和表名。