Hello!
I’m receiving data in the URL that tells me if a person wants to do something NOW or LATER.
I have a series of surveys that need to display one after another.
I would like to show the survey’s marked as NOW first, then show the survey’s marked as LATER.
The first URL I receive will look something like this: surveygroup.php?suvey1=NOW&survey2=LATER&survey3=NOW&survey4=&survey5=LATER
The order I want to show the survey’s would be:
- survey1
- survey3
- survey2
- survey5
(skip survey4)
The trouble starts after the first survey is submitted. Because I’m using a 3rd party to handle the forms, I need to redirect back to my page. The redirect URL could tell me which form was just filled out. But I’ll need to keep the arrays in the global $_SESSION so I can somehow keep stepping through the NOW and LATER arrays.
I’ve got this so far:
if (!empty($_GET['survey1'])) {
if($_GET['survey1'] == 'NOW') {
$now[] = 'survey1';
} else {
$later[] = 'survey1';
}
}
// repeat for each survey...
$_SESSION['now'] = $now;
$_SESSION['later'] = $later;
Once the first survey is submitted, I would need to move the array pointer to the next survey in the NOW array. Once I’m at the end, I would start the LATER array, until I reached the end of that array, and show a thank you message.
If this makes sense to you, that’s wonderful! If you have a suggestion for me, I’d greatly appreciate it.