要求是当我在输入字段中输入新值并按下更新按钮然后它应该添加现有值并且答案将显示在相同的输入字段中。 请帮助我在这种情况下。提前谢谢。
<?php
include("../assets/includes/header.php");
require_once("../assets/db/connect.php");
/**************** UPDATE QUERY COUNTER CASH **************************/
if(isset($_POST['update_btn_counter']))
{
mysqli_query($link,"UPDATE aks_counter SET counter_balance='$_POST[balance]' WHERE counter_id='$_POST[counter_hidden]' ");
}
$countercash_query = mysqli_query($link,"SELECT * FROM aks_counter");
?>
<!doctype html>
<html>
<head>
<title>AKS</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<link href="../assets/css/aks.css" rel="stylesheet" type="text/css">
<link href="../assets/css/mobile.css" rel="stylesheet" type="text/css">
</head>
<body class="pages" id="customer">
<div class="container">
<h2> Counter Cash </h2>
<?php
while ($counter_row = mysqli_fetch_array($countercash_query))
{
echo "<form action=balance1.php method=post id=counter_cash_form>";
echo "<input type=submit name=update_btn_counter value=Update>";
echo "<input type=number class=input_field name=balance value='" . $counter_row['counter_balance'] . "'>";
echo "<input type=hidden name=counter_hidden value='" . $counter_row['counter_id'] . "'>";
echo "</form>";
}
?>
</div>
</body>
</html>
答案 0 :(得分:0)
使用+代替=
counter_balance +&#39; $ _ POST [余额]&#39;