当我在字段(Section, Title of Documents等)上输入值,然后单击submit时,它会显示一个弹出对话框,表示它已被发送到数据库(我的php文件中没有错误)。当我点击"确定"时,它会重定向到另一个页面,这是我的主php文件的表单操作。它如何保持在同一页面上而不重定向?
下面是我的代码:<?php
?>
<html>
<head>
<link rel="shortcut icon" href="favicon.ico" >
<link rel="stylesheet" type="text/css" href="text.css" />
<title>Quality Management System</title>
<script language = "javascript">
function myFunction() {
confirm("Sent to Database!");
}
</script>
</head>
<body>
<center>
<img src = "logo.png">
<body bgcolor = "#191970">
<p>
<font color= #FFF8DC>
<font face = "Verdana">
<font size = 6>
<b> QMS - Quality Management System</b>
</font>
<p>
<ul id="menu-bar">
<li><a href="index.php">Home</a></li>
<li><a href="QualityManual.php">Quality Manual</a></li>
<li><a href="QualityProcedures.php">Quality Procedures</a></li>
<li><a href="WorkInstructions.php">Work Instructions</a></li>
<li><a href="#">Support Documents</a>
<ul>
<li><a href="QualityForms.php">Quality Forms</a></li>
<li><a href="Reference.php">Reference</a></li>
<li><a href="JobDescription.php">Job Description</a></li>
</ul>
</ul>
<p>
<font size = 6 font face = "Verdana" font color= #FFF8DC> Quality Manual</font>
<p>
<br>
<form action = "displayQM.php" method = "post" onsubmit="myFunction()">
<table BORDER="2" style="border:5px solid white;border-collapse:collapse;">
<tr>
<th rowspan="2" bgcolor = "#D3D3D3"><font face = "Verdana">Section</th>
<th rowspan="2" bgcolor = "#D3D3D3"><font face = "Verdana">Title of Documents</th>
<th rowspan="2" bgcolor = "#D3D3D3"><font face = "Verdana">Document No.</th>
<th colspan="5" bgcolor = "#D3D3D3"><font face = "Verdana">Revision Status </th>
<th rowspan="2" bgcolor = "#D3D3D3"><font face = "Verdana">Number <br>of Pages</th>
</tr>
<tr>
<td bgcolor = "#D3D3D3"><font face = "Verdana"><center>0</center></td>
<td bgcolor = "#D3D3D3"><font face = "Verdana"><center>1</td>
<td bgcolor = "#D3D3D3"><font face = "Verdana"><center>2</td>
<td bgcolor = "#D3D3D3"><font face = "Verdana"><center>3</td>
<td bgcolor = "#D3D3D3"><font face = "Verdana"><center>4</td>
</tr>
<tr>
<td><input type = "text" name = "QMsection_1" size = "9" placeholder="(Enter Section)" value = "" maxlength = "5" align = "right" tabindex ="1"></td>
<td><input type = "text" name = "QMtitleofdocuments_1" size = "30" placeholder="(Enter Title of Document)" value = "" maxlength = "100" align = "right" tabindex ="1"></td>
<td><input type = "text" name = "QMdocumentno_1" size = "14" placeholder="(Enter Document No.)" value = "" maxlength = "100" align = "right" tabindex ="1"></td>
<td><input type = "text" name = "QMrevisionstatus0_1" size = "7" value = "" maxlength = "10" align = "right" tabindex ="1"></td>
<td><input type = "text" name = "QMrevisionstatus1_1" size = "7" value = "" maxlength = "10" align = "right" tabindex ="1"></td>
<td><input type = "text" name = "QMrevisionstatus2_1" size = "7" value = "" maxlength = "10" align = "right" tabindex ="1"></td>
<td><input type = "text" name = "QMrevisionstatus3_1" size = "7" value = "" maxlength = "10" align = "right" tabindex ="1"></td>
<td><input type = "text" name = "QMrevisionstatus4_1" size = "7" value = "" maxlength = "10" align = "right" tabindex ="1"></td>
<td><input type = "text" name = "QMnumofpages_1" size = "10" value = "" maxlength = "3" align = "right" tabindex ="1" ></td>
</tr>
</table>
<p>
<input type="submit" value="Submit" name="submit">
</p>
</form>
</body>
</html>
保持动作值为空
<form action = "" ....