Home > Backend Development > PHP Tutorial > php表单跳转保留数据

php表单跳转保留数据

WBOY
Release: 2016-06-13 12:22:47
Original
1304 people have browsed it

求助 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 />							    &nbsp&nbsp&nbsp<b>输入用户名:&nbsp&nbsp</b><input type="text" class="inputstyle" id="username" name="username" value="" tabindex="1"><br />							</div><br />							<div class="inputOuter"><br />								&nbsp&nbsp&nbsp<b>请输入密码:&nbsp&nbsp</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>
Copy after login


record.php
<?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 />?>
Copy after login

------解决思路----------------------
iframe 或ajax  提交表单 你度娘吧。。。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template