I currently have a 1 page site where i am trying to store a session variable and then call it into various other pages that are included when different links are chosen. I currently have the code passing the variable to the first included page but it does not pass to the 2nd included code.
Someone has suggested it is because the variable is initially posted from a form
<?php session_start(); $_SESSION['app_name'] = $_POST['app']; $_SESSION['serv_name'] = $_POST['server']; ?>
And then brought into the page in question
<?php session_start(); $app_name = $_SESSION['app_name'] ?>
I basically then just call $app_name to get the variable.
However..when i try and bring in another page, it doesnt recognise the session variable anymore, as if it has been reset but me clicking on another link. Someone has suggested that this is because the form is posting to itself and that the page must be refreshing without a value when the 2nd link is clicked
they have suggested something along the lines of the following but i really dont know where to start with this. Any help would be much appreciated.
if ($_POST['app'] is not null) and ($_POST['app'] == "") then $_SESSION['app_name'] = $_POST['app'] ; endif