Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/251.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用两个网页提交表单值_Php_Javascript_Jquery_Html_Dhtml - Fatal编程技术网

Php 使用两个网页提交表单值

Php 使用两个网页提交表单值,php,javascript,jquery,html,dhtml,Php,Javascript,Jquery,Html,Dhtml,我一共有3页;表单元素分布在两个页面“eg1.html”和“eg2.html”中,但表单元素提交到“eg.php” 下面是eg.php的代码: $size=$_POST["fontsize"]; $label=$_POST["label"]; $age=$_POST["age"]; $sex =$_POST["sex"]; eg1.html的代码 <html> <body> <form action="eg.php" method="post">

我一共有3页;表单元素分布在两个页面“eg1.html”和“eg2.html”中,但表单元素提交到“eg.php”

下面是eg.php的代码:

$size=$_POST["fontsize"];
$label=$_POST["label"];
$age=$_POST["age"];
$sex =$_POST["sex"];
eg1.html的代码

 <html> 
 <body> 
 <form action="eg.php" method="post"> 
 <input type="radio" name="fontsize" value="3"/> 
 <link to eg2.html>
 <input type="radio" name="label" value="stacks"/> 
 <input type="submit" name = "down" value = "down"> 
 </form> 
 </body>
 <html> 
 <body> 
 <form action="eg.php" method="post">
 <input type="radio" name="age" value="18"/> 
 <input type="radio" name="sex" value="female"/> 
 <input type="submit" name = "down" value = "down"> 
 </form> 
 </body> 
 </html>

eg2.html的代码

 <html> 
 <body> 
 <form action="eg.php" method="post"> 
 <input type="radio" name="fontsize" value="3"/> 
 <link to eg2.html>
 <input type="radio" name="label" value="stacks"/> 
 <input type="submit" name = "down" value = "down"> 
 </form> 
 </body>
 <html> 
 <body> 
 <form action="eg.php" method="post">
 <input type="radio" name="age" value="18"/> 
 <input type="radio" name="sex" value="female"/> 
 <input type="submit" name = "down" value = "down"> 
 </form> 
 </body> 
 </html>

我在
eg1.html
中添加了一个指向
eg2.html
的链接。这意味着首先用户将打开
eg1.html
;他将在提交表单元素之前选择表单元素,他将获得一个链接,链接到
eg2.html
;一旦他点击链接,他将被重定向到eg2.html

eg2.html
中,他应该能够选择其他表单元素,选择后他将被重定向回
eg1.html
,在那里他将能够将所有表单元素提交到
eg.php
[其中包括eg1和eg2]


我见过许多网站使用这项技术。

根据您希望如何处理这项技术,您可以

  • 让服务器缓存响应的前半部分
  • 将数据传递到要一起提交的第二页
  • 把它们放在一页里,让它看起来像两页
  • 要在服务器上缓存,可能需要使用临时文件或数据库。这是非常麻烦的,但好处是用户可以完成一半,去吃饭,然后回来继续

    要将数据传递到第二页,您可以选择使用
    location.hash
    将该信息附加到下一页的链接中。或者,您可以使用


    第三个也相对容易实现。对每页使用
    divs
    iframes
    ,并让顶部文档保存数据。

    ?请解释清楚。听起来您的用户正在部分填写表单,提交表单,然后返回完成表单。对吗?请检查你的拼写;这是很难破译你的句子,因为是的,因为我已经提到表单元素分布在两个页面eg1.html和eg2.html中…请检查eg1.html中是否有,这意味着用户没有提交表单,他应该单击链接,该链接将他重定向到eg2.html,他将在那里选择并提交将要获取的值通过eg.php,然后他将被重定向回eg1.html,以提交eg.php中的其他值……你可以将其拆分为多个句子吗?思路打字很难理解。甚至可以尝试一个图表?web上的表单有一个核心规则:始终向自身发送表单,在那里验证表单,然后在必要时重定向。