The following pseudo code does not work the way I expect and I’m looking to see if there is a native solution.
config.php
...
$g_current_survey = '';
...
~EOF
admin.php
require_once('config.php');
...
if isset $_POST['survey_name']
$g_current_survey = $_POST['survey_name'];
echo "current survey is " . $g_current_survey;
~form for entering survey_name
~EOF
My question is that after the user submits the form, the value gets overwritten (in the case of =”;, or unset if the variable was not assigned a value on declaration) on next page refresh, and every other script that imports config.php won’t see the change. How do I set this without going to mysql or a flat file?
Don’t mention sessions, because this change does not need to be unique to each user, it needs to be sitewide. i.e. any new user who joins gets associated with the current survey.
Thanks.
You need to be able to persist this change between scripts and as PHP lacks application scope, you need to use an external tool.
Your typical options are: