多步php表单

I am using a 3 step php form that sends data to my email. I use three different php file for that.

First form should store data as $_SESSION and redirect to the next form. Second form does the same. But when I complete the third (last) form it only sends the data from the third form. Does't get the stored data from the first two form.

As I have php 5.3+ version, I can't use session_register();. Here is all the forms scripts.

Here are Form 1 and Form 2

And Form 3

I don't know what I missed. Is there any other way to store and use input data? Any help will be appreciated. Thanks.

An approach I've used is to store all the data from the previous step in hidden inputs (<input type="hidden">) with the same name. That way they're all accessible in $_POST[].

Note: If you do this, have any password fields on the last step. You should not be putting passwords in your HTML in plaintext.

I can see the problem with your code is that you put the redirection header before the session var was set.

I mean, this part:

$_SESSION['condition_home'] = $_POST['condition_home'];
$_SESSION['selling_plan'] = $_POST['selling_plan'];
$_SESSION['comment'] = $_POST['comment'];

should be before header('Location: second_page.php');