That's a good point Everah, and I must admit that I do use the sessions method myself.
As an example, on the processing side, just save any values submitted to a session var for form 1 values. Then when you come to the second form, you can check to make sure that the form 1 values exist.
Code: Select all
session_start();
if(isset($_SESSION['form_1'])) {
// this form must be form 2
$_SESSION['form_2']['data'] = $_POST['data'];
} else {
// this form is form 1
$_SESSION['form_1']['data'] = $_POST['data'];
}
Then on form 2, you can just look for verification of form 1 and redirect if it doesn't exist.
Code: Select all
<?php
session_start();
if(!isset($_SESSION['form_1'])) {
header('Location: http://www.yourdomain.com/form_1.php');
exit();
}
?>
Then on the display side of form 1, you can display the previously entered data, if it exists.
Code: Select all
// top of page
<?php
session_start();
if(isset($_SESSION['form_1'])) $preload = $_SESSION['form_1'];
?>
// in form
<input name="data" type="textbox" value="<?php if(isset($preload)) echo $preload['data']; ?>">
This example is all a bit rough and ready and totally untested, but it should get you started. Once you get the idea, you should be able to see how to use a single processing script and redirect to the correct form, etc.
Hope it helps anyhow.