1

我有一个注册表单,有 3 页。我使用 jquery $post 发布错误消息而不刷新第二个 php 页面将检查所有数据。如果所有数据都正确,它将发送到第三页(协议页)。如果用户在第三页点击同意,则所有数据都将写入数据库。

但是我有问题通过使用 if & else 将数据发布到 php 中的第三页

这是一个注册表单。因此我不能使用 $_GET[]

ex. else{header("location:agreement.php?email=somedata&pw=somedata");}

有什么方法可以将这些数据传递到 php 中的第三页?

第 1 页

    <form>
    <input type="text" name="email"/>
    (some input)...

    <input type="button" onclick="get();"/>
    </form>



JQUERY
function get(){
    $('#error').hide();
    $.post('signup.php',{firstname:signup.firstname.value,...},
    function(output){$('#error').html(output).fadeIn(50);})
    }

第二页

signup.php
    if(will check everything){echo "error";}
      //Jquery will output error without refresh the page
    else{
        [Need to POST all sign up data from 1st page to 3rd page]
        header("to agreement.php");
    }

第三页

agreement.php
if user tick agree. All sign up data will insert into database.
4

4 回答 4

1

为什么不将数据存储在会话中?然后,您可以轻松地在第 3 页上检索它,而无需将其传递给客户端,然后再传递给服务器并再次返回给客户端。

于 2013-04-02T10:13:51.147 回答
1

当您添加数据然后在第一个表单上将数据添加到表中并在会话和所有其他表单页面上使用 record_id 时,只需更新该数据库记录

于 2013-04-02T10:18:16.830 回答
1

将其存储在会话中,或者如果您显示页面将其存储在其中,您也可以使用 CURL,但它是“硬”的方式。使用 curl 您可以将 POST 与您想要的所有变量一起发送到另一个页面。

于 2013-04-02T10:23:35.003 回答
0

发送email到 3rd php的示例

function get(){
var email = $('#email').val();
    $('#error').hide();
    $.post('signup.php',{firstname:signup.firstname.value,email:email,...},
    function(output){$('#error').html(output).fadeIn(50);})
    }

signup.php
$email = $_GET['email'];
    if(will check everything){echo "error";}
      //Jquery will output error without refresh the page
    else{
        [Need to POST all sign up data from 1st page to 3rd page]
        header("to agreement.php?".$email);

agreement.php
$email = $_POST['email'];
if user tick agree. All sign up data will insert into database.
    }
于 2013-04-02T10:28:39.037 回答