Forum Moderators: coopster
Thanks.
if (
(isset($_POST['some_var_from_step_1'])) and
(isset($_POST['some_var_from_step_2']))
) {
// Output step 3.
// Of course, don't use $_POST directly, cleanse your data
}
else if (isset($_POST['some_var_from_step_1'])) {
// Output step 2, store a var from step 1 as a hidden
// or session variable.
}
else {
// output step 1
}
if(!isset($_SESSION[stage]);
$_SESSION[stage] = 0;
else
$_SESSION[stage] = $_SESSION[stage]++;
function stage1()
{
/* relevant coding */
}
function stage2()
{
/* relevant coding */
}
/* Etc. ...*/
function defaultDisplay()
{
/* relevant coding */
}
$stage = (int)$_SESSION[stage];
switch($stage)
{
case 1:
stage1();
break;
case 2:
stage2();
break;
/* Continue as needed */
default:
defaultDisplay();
}
I find that the switch statement is more intuitive when going back months (or years) later. Far easier than trying to decipher a long string of if/else statements.