I need to develop a form that spans multiple pages, but requires just one PHP script. On the first page, visitors are presented with a series of checkboxes. Depending on their choice(s), additional pages must be displayed in a specific order and then to a closing page. Each page contains a hidden input identifying what page number it is. What I have so far is this:
if(!isset($currentPage)) {
echo $firstPage;
}
else {
echo nextPage($currentPage);
}
function nextPage($lastPage) {
switch($lastPage) {
case '0':
if(isset($opt1)) {
return $page1;
}
else if(isset($opt2)) {
return $page2;
}
case '2':
if(isset($opt3)) {
return $page3;
}
case '3':
case '1':
return $page4;
}
}
The above code properly identifies whether to display page1, page2 or page3 after the starting page, but after that, no matter what other choices may have been selected, it always directs the visitor to the closing page (page4). What am I missing? Or have I gone about this all wrong?