Problem: I set a variable in session before redirection, and it is not working after redirection (in success PHP file)
- I have used symfony setflash/getflash ,session but none method works.
Code: controller:
function abc()
{
$bold_message="<b>".$gnotes_message->getGnoNote()."</b><br>";
echo $_SESSION["msge"] =$bold_message;
$this->getUser()->setFlash('message', $bold_message,true);
$this->getUser()->setAttribute('msg',$bold_message);
var_dump($_SESSION["msg"]);die;//output : some message
return $this->redirect('@homepage');
}
signinsucces view file
<?php var_dump($_SESSION['msge']); die("halt");//output: NULL
if ($sf_user->hasFlash('message')): ?>
<div class="flash_error"><p><?php echo $sf_user->getFlash('message') ?> </p></div>
<?php echo $sf_user->getFlash('error') ?>
</div>
- I Have tried simple core concept of setting session in php i.e.
$_session
but after redirect session and setflash not working
I have checked this thread: Symfony: pass parameter between actions (with a redirect)
What I need is to get access session in success.php file:
$this->getUser()->getAttribute('msg');