嗨,我有三个表单,我想用一个提交按钮保存三个表单的值,该按钮位于 php 中的三个表单之外我正在使用 javascript 提交我的表单,现在我想将数据保存到我的数据库中。这是我的 javascript
function submit()
{
document.form1.submit();
document.form2.submit();
document.form3.submit();
}
这是我的 php
if(isset($_POST["submit"])){
browse("1213 1314");
$gen1 = mysql_query("SELECT MAX(accode) AS maxcode FROM quotmain LIMIT 0,1 ") or die(mysql_error());
if (mysql_num_rows($gen1) > 0) {
$vvouch = mysql_fetch_assoc($gen1);
$qvouch = $vvouch["maxcode"] + 1;
} else{
$qvouch = '1';
}
$a = 1;
$vouchdt = mydt($_POST["vouchdt"]);
$name = $_POST["cmbparty"];
$refno = $_POST["refno1"];
browse($refno);
$attn = $_POST["attn"];
$subj = $_POST["subject"];
$msg = $_POST["messsage"];
$rem = $_POST["rem"];
$count = $_POST["items"];
$h = $_POST["h"];
$status = $_POST["cmbstatus"];
mysql_query("DELETE FROM quotdtl WHERE vouchno='$qvouch'") or die(mysql_error());
for ($i = 1; $i <= $count; $i++) {
$ord = $_POST['ord_' . $i];
$srno = $_POST['srno_' . $i];
$descrip = $_POST['descrip_' . $i];
$unit = $_POST['unit_' . $i];
$rate = $_POST['rate_' . $i];
mysql_query("INSERT INTO `quotdtl`(vouchno, orderby, srno, `descrip`, unit, rate)
VALUES('$qvouch', '$ord', '$srno', '$descrip', '$unit', '$rate')") or die(mysql_error());
}
mysql_query("DELETE FROM quotnotes WHERE vouchno='$qvouch'") or die(mysql_error());
for ($i = 1; $i <= $h; $i++) {
$notes = $_POST['notes' . $i];
mysql_query("INSERT INTO `quotnotes`(vouchno, `notes`)
VALUES('$qvouch', '$notes')") or die(mysql_error());
}
if ($addflag == 1) {
mysql_query("INSERT INTO `quotmain`(vouchno, `vouchdt`, `party`, refno, `attn`, `subject`, `message`, `rem1`, `status`, `username`)
VALUES($qvouch, '$vouchdt', '$name', '$refno', '$attn', '$subj', '$msg', '$rem', '$status','$_SESSION[username]')") or die(mysql_error());
insmess();
header("refresh: 1; quotation.php?mode=true");
} else {
$mvouch = $_POST["vouch"];
mysql_query("UPDATE `quotmain` SET `vouchdt`='$vouchdt', `name`='$name', refno='$refno', `attn`='$attn', `subject`='$subj',
`message`='$msg', `rem1`='$rem', `username`='$_SESSION[username]' WHERE vouchno = '$mvouch' ") or die(mysql_error());
updmess();
header("refresh: 1; menu.php?action=quotation");
}
}