2

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>

What I need is to get access session in success.php file:

$this->getUser()->getAttribute('msg');
Community
  • 1
  • 1
vineet
  • 107
  • 8

0 Answers0