1

I have a sign up form came with 3 pages. I use jquery $post to post error message back without refresh 2nd php page will check all data. if all data correct than it will send to 3rd page(agreement page). If user click agree in 3rd page, than all data will write into database.

However I have problem to post data to 3rd page in php by using if & else

This is a sign up form. Therefor I can't use $_GET[]

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

is any way I can pass those data to 3rd page in php?

1st page

    <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);})
    }

2nd page

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");
    }

3rd page

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

4 Answers 4

1

Why do you not store the data in the session? Then you can easily retrive it on page 3 without having it to pass to the client, then the server and back to the client again.

Sign up to request clarification or add additional context in comments.

2 Comments

i was thinking to use session before, however like google chrome always save session even the browser is closed
And why is that a problem? If you construct your page correctly then revisiting the registration page will overwrite the data anyway.
1

When You Add Data Then On First Form Add Data into Table and use record_id in session and on all other Form Pages Just Update That database Record

Comments

1

Store it in session or if you show pages store it in you can also use CURL but it's "hard" way to make it. With curl you can send POST with all variables you want to another page.

Comments

0

Example for sending email to 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.
    }

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.