I am adding in a form with just 2 radio buttons using Perch CMS and trying to stop it from having the option of resubmitting the form after it has been submitted once during a session by finding the success code of <!--@@^^res@@^^-->
I have the session start above all other code and also above my but cannot get it to work properly.
My code is as follows which in my head says if the session is equal to submitted then the success code is there and so will not show the content however if there is not session set then the success code is not there and therefore requires the content to be displayed. Once the form is submitted and the success code is output, a session of submitted is then created...
<?php if (isset($_SESSION['survey']) == 'submitted')
echo (strpos($content,'<!--@@^^res@@^^-->')!=false);
else {
$content = perch_content('Survey',true);
echo str_replace('<!--@@^^res@@^^-->','',$content);
if (strpos($content,'<!--@@^^res@@^^-->')!=true) {
$_SESSION['survey'] = 'submitted';
};
};
?>
I noticed that this works upon load as in I get the form there but when I change page it disappears as well as after filling out the form.
tried Googling this but cannot get my head round where I am going wrong, any help is greatly appreciated.