top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

How to display flash messages in CakePHP?

0 votes
How to display flash messages in CakePHP?
posted Jul 31, 2014 by Mohit Sharma

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

To set a message, use setFlash:
You need to use setflash method of session to set your message.
// In the controller.
$this->Session->setFlash('Your stuff has been saved.');

Use the following code in your .ctp file where you wnat to display the message.

echo $this->Session->flash();

This will display the message in your .ctp file

answer Aug 1, 2014 by Rahul Mahajan
Contact Us
+91 9880187415
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Karnataka INDIA.