Maison > Article > développement back-end > php表单跳转保留数据
求助 php表单跳转保留数据
求助 希望能够点击提交按钮后,表单数据保留而且不弹出新窗口 如何实现啊?
代码如下
login.html
<form id="loginform" name="loginform" action="login.php" method="post" onSubmit="return InputCheck(this)" autocomplete="off"><br /> <div id="login" class="login"><br /> <form id="loginform" name="loginform" action="login.php" method="post" onSubmit="return InputCheck(this)" autocomplete="off"><br /> <div class="inputOuter"><br />    <b>输入用户名:  </b><input type="text" class="inputstyle" id="username" name="username" value="" tabindex="1"><br /> </div><br /> <div class="inputOuter"><br />    <b>请输入密码:  </b><input type="password" class="inputstyle password" id="password" name="password" value="" maxlength="16" tabindex="2"> <br /> </div><br /> <div class="submit"><br /> <input type="submit" tabindex="6" value="" class="btn" id="login_button"><br /> </div><br /> </form>
<?php<br /> $con = mysql_connect("localhost","root","w123456");<br /> if (!$con)<br /> {<br /> die('Could not connect: ' . mysql_error());<br /> }<br /><br /> mysql_select_db("peixunrecord", $con);<br /> mysql_query("set names 'utf8'");<br /><br /> $bumen = $_POST['bumen'];<br /> $keduimokuai = $_POST['keduimokuai'];<br /> $xingming = $_POST['xingming'];<br /> $peixunshijian = $_POST['peixunshijian'];<br /> $keti = $_POST['keti'];<br /> $xinde = $_POST['xinde'];<br /> $sql="INSERT INTO record (bumen,keduimokuai,xingming,peixunshijian,keti,xinde) VALUES ('$bumen','$keduimokuai','$xingming','$peixunshijian','$keti','$xinde')";<br /> if (!mysql_query($sql,$con))<br /> {<br /> die('Error: ' . mysql_error());<br /> }<br /> <br /> 这块怎么能实现需求呢?谢谢了!<br /><br /> //echo "<script>alert('提交成功!');location.href='".$_SERVER["HTTP_REFERER"]."';</script>";<br /> //echo "提交成功 3秒后自动跳转";<br /> // echo "若没自动跳转,请点击<a href='javascript:history.go(-1)'>这里</a>返回";<br /> //header("Refresh:5;url=http://www.baidu.com");<br /> mysql_close($con);<br />?>