Basically, it works like this. Maybe this excerpt of my code can help you:
<?php
// Check the step
if (isset($_GET['s']) == true) {
$step = $_GET['s'];
}
else {
$step = 0; // set step to 0 so the first page will be shown
}
if ($step == 0) {
}
elseif ($step == 1) {
}
elseif ($step == 2) {
}
?>
So, it's just working with ifs and elseifs.
When you add a form to this, it can look like this:
You always add a variable to the links with the number of the step you want to do.
Look at the form action in the second step.
<?php
// Check the step
if (isset($_GET['s']) == true) {
$step = $_GET['s'];
}
else {
$step = 0; // set step to 0 so the first page will be shown
}
//// First Step
if ($step == 0) {
// Write something... put a link to the form with a certain id and the number of the step (s=1)
// The view.php opens itself with s=1 (see second step)
$link = "?id="25"&s=1";
} // End First Step
//// Second Step
elseif ($step == 1) {
// GET step number
$id = $_GET['id'];
// When the form is sent, it's sent to the view.php with step = 2
echo "
<form action='?s=2' method='post'>
<table>
<tr>
<td>Anzahl Personen</td>
<td>
<select name='personenzahl' size='1'>
<option value='1'>1</option>
<option value='2'>2</option>
<option value='3'>3</option>
</select>
</td>
</tr>
<tr>
<td></td>
<td><input type='submit' value='Send' /></td>
</tr>
<tr>
<td></td>
<td><a href='?s=0'>Abort</a></td>
</tr>
</table>
</form>
</div>";
}
} // End Second Step
//// Third Step - Send E-Mail
elseif ($step == 2) {
// get data per POST from step = 1
$personenzahl = $_POST['personenzahl'];
// Send E-Mail
if (mail($empfaenger, $betreff, $text, $from)) {
echo "Successful<br /><br />";
echo "<a href='?s=0'>Back</a>";
}
}
}
?>
Hope this helps!
Best regards,
LuuQ