我的代码在下面
<form action="POST">
<td class="tg-yw4l" ><?PHP echo $_CONFIG['item_Id']?></td>
<td class="tg-yw4l" ><?PHP echo $_CONFIG['item_Name']?></td>
<td class="tg-yw4l" ><?PHP echo $_CONFIG['itemPicture']?></td>
<td class="tg-yw4l" ><?PHP echo $_CONFIG['market_Value']?></td>
<td class="tg-yw4l" ><?PHP echo $_CONFIG['bptf_Value']?></td>
<td class="tg-yw4l" ><?PHP echo $_CONFIG['opskins_Value']?></td>
<td class="tg-yw4l" ><input name="sell" placeholder="<?PHP echo "$".$Sell_Price?>" value="<?PHP echo $Sell_Price?>"></td>
<td class="tg-yw4l" ><input name="keys" placeholder="<?PHP echo $Keys_Price."K"?>" value="<?PHP echo $Keys_Price?>"></td>
<td class="tg-yw4l" ><input name="refs" placeholder="<?PHP echo $Refs_Price."R"?>" value="<?PHP echo $Refs_Price?>"></td>
</form>
它位于一个表中,输入name sell使用我的php后端代码保存到sql,但不确定为什么name键和name ref不起作用;我的意思是它确实有文本框,但没有保存到sql。
下面是它的后端php代码:
if (isset($_POST['submit'])) {
if($s_Bot_Id == $f_Bot_Id ){
if(isset($_POST['sell'])){
$content = $_POST['sell'];
$sql_table = "bot_items_db";
$sql = "UPDATE $sql_table SET Sell_Price=? WHERE Bot_Id=?";
$id = $s_Bot_Id;
$stmt = $conn->prepare($sql);
$stmt->bind_param('ss', $content, $id);
if ($stmt->execute()){
return $stmt->affected_rows;
$stmt->close();
}else {
echo "save not working";
}
}
if(isset($_POST['keys'])){
$content = $_POST['keys'];
$sql_table = "bot_items_db";
$sql = "UPDATE $sql_table SET `Keys_Price` = ? WHERE Bot_Id = ?;";
$id = $s_Bot_Id;
$stmt = $conn->prepare($sql);
$stmt->bind_param('ss', $content, $id);
if ($stmt->execute()){
return $stmt->affected_rows;
$stmt->close();
}else {
echo "save not working";
}
}
if(isset($_POST['refs'])){
$content = $_POST['refs'];
$sql_table = "bot_items_db";
$sql = "UPDATE $sql_table SET Refined_Price=? WHERE Bot_Id=?";
$id = $s_Bot_Id;
$stmt = $conn->prepare($sql);
$stmt->bind_param('ss', $content, $id);
if ($stmt->execute()){
return $stmt->affected_rows;
$stmt->close();
}else {
echo "save not working";
}
}
1条答案
按热度按时间nqwrtyyt1#
你也应该在你的html上添加一个id来获取你不能通过名称获取的数据