I am working on E-commerce Web Application, which is having users and permissions to them.. So according to their permission,
For Ex: I am storing variable $chk = 'write' or $chk = 'read' on session and my condition is
if ($chk == 'write')
{
// some function here to modify the page & its content
// If true, then display SAVE button to save all changes made.
}
But, Sometimes my page cant access this variable, the value of $chk is unknown hence its not displaying SAVE button. But, it shows the button after refreshing the page or visiting sometime later. Can anyone help me to solve this.. Thanks in advance
Session variables in PHP need to be stored in the
$_SESSIONmagic variable to persist them across multiple pages. To ensure that a page has access to the session, you also need to callsession_start()on each page.In this case, changing
$chkto$_SESSION['chk']and addingsession_start()at the top of each page will probably do the trick.