Click to See Complete Forum and Search --> : Mutliple page wizard


scriptkiddy
10-12-2005, 04:58 AM
Hi,

I have developed a multipage wizard which takes the user through a series of steps (pages) e.g step1, step2, step3. What i want to do is when the user initially comes to the wizard (step1) they can see all the steps but cannot go straight to step3. After the user has gone through the wizard at least once then they can go to any step they want. Basically the links to the steps are activated after the user has visited them at least once.

I know this can be done by using cookies or sessions in PHP but but i dont know the coding. Please can anybody help!!

Kiddy

cwrath
10-12-2005, 02:13 PM
<?
function lockPage($level) {
if($_SESSION['level'] == "" ) {
header('Location: ./page1.php');
exit();
}

elseif ( ($_SESSION[level] != $level) ) {
echo "Please complete page ($level - 1);
exit();
}
}

?>

put that in lockpage.php and when you want to lock a page...


say this was page two..
<?php

include('lockpage.php');

if(isset($_POST[foo]) {
session_start();
$_SESSION[level] = 2;
}

lockpage('2');

?>