[英]How to remember form values across different pages?
I need to send form values from one page to another and from that page to a third page. 我需要将表单值从一页发送到另一页,再从该页发送到第三页。 I would need the form values from the first page in the third page.
我需要第三页第一页中的表单值。 How can I do it?
我该怎么做?
I have the code that transfers form values to the next page. 我有将表单值传输到下一页的代码。 How can I send the same form values to the third page?
如何将相同的表单值发送到第三页?
<script type="text/javascript" src="jquery-1.2.6.min.js"></script>
<script type="text/javascript">
// we will add our javascript code here
$(document).ready(function(){
$("#ajax-contact-form").submit(function(){
var str = $(this).serialize();
$.ajax({
type: "POST",
url: "contact.php",
data: str,
success: function(msg){
$("#note").ajaxComplete(function(event, request, settings){
if(msg == 'OK') // Message Sent? Show the 'Thank You' message and hide the form
{
result = '<div class="notification_ok">Your message has been sent. Thank you!</div>';
window.location.href = "http://www.google.com";
$("#fields").hide();
}
else
{
result = msg;
}
$(this).html(result);
});
}
});
return false;
});
});
</script>
you can use GET 你可以使用GET
window.location.href = "http://yourdoamin?value= serialize text variable";
Assuming you're using only simple values (not passing arrays), you can do something like this: 假设您仅使用简单值(不传递数组),则可以执行以下操作:
echo "<form id='second_page' method='post' action='third_page.php'>";
foreach ($x in $_POST) {
echo '<input type="hidden" name="' . htmlspecialchars($x) . '" value="' . htmlspecialchars($_POST[$x]) . '" />';
}
You can set the values from Form #1 as input
tags with hidden
type in Form #2. 您可以将表格1中的值设置为表格2中具有
hidden
类型的input
标签 。 That way, when you submit Form #2, values will be available in Form #3. 这样,当您提交表格2时,值将在表格3中可用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.