var pClicks = <?php echo $pro ?>;
var nClicks = <?php echo $nordic ?>;
function mySubmit() {
document.getElementById('pro').value = pClicks;
document.getElementById('nordic').value = nClicks;
document.getElementById("proForm").submit();
document.getElementById("nordicForm").submit();
}
function pJuurde() {
pClicks += 1;
document.getElementById("pClicks").innerHTML = pClicks;
};
function pMaha() {
pClicks -= 1;
document.getElementById("pClicks").innerHTML = pClicks;
};
function nJuurde() {
nClicks += 1;
document.getElementById("nClicks").innerHTML = nClicks;
};
function nMaha() {
nClicks -= 1;
document.getElementById("nClicks").innerHTML = nClicks;
};
&#13;
<form id="nordicForm" action="nordicSave.php" method="post">
<input id= 'nordic' name='nordic' value='nordic' />
</form>
<form id="proForm" action="proSave.php" method="post">
<input id= 'pro' name='Pro' value='pro' />
</form>
<button type="submit" onclick="mySubmit()"> Salvesta </button>
</body>
<?php
include("testmysql.php");
$pro = $_POST["pro"];
$db->query("UPDATE mastid SET pro = $pro");
header("Location: index.php");
?>
<?php
include("testmysql.php");
$nordic = $_POST["nordic"];
$db->query("UPDATE mastid SET nordic = $nordic");
header("Location: index.php");
?>
&#13;
答案 0 :(得分:0)
<form id="nordicForm" action="nordicSave.php" method="post">
<input id= 'nordic' name='nordic' value='nordic' />
</form>
<form id="proForm" action="proSave.php" method="post">
<input id= 'pro' name='Pro' value='pro' />
</form>
我删除了1个表单标记,只将其转换为一个表单。那样的。
<form id="proForm" action="proSave.php" method="post">
<input type="Hidden" id='pro' name='pro' value='pro' />
<input type="Hidden" id='nordic' name='nordic' value='nordic' />
</form>
它创造了奇迹