Solved

CakePHP setFlash - Can it pass a variable to view?

Posted on 2011-09-25
1
320 Views
Last Modified: 2012-05-12
Beneath is the code I'm using.  I'd like to offer the user the ability to restore the id of whatever it is they just deleted.  In order to do that I need to pass the id back to the view file:
	function admin_delete($id = null) {
		if ( !$id ) {
			$this->Session->setFlash('Invalid event', true);
			$this->redirect(array('action' => 'index'));
		}
		if ($this->Event->softDelete( $id )) {
			$this->Session->setFlash( 'Event deleted', true , array( 'restoreID' => $id ) );
			$this->redirect( array( 'action' => 'index' ) );
		}
	}

Open in new window

0
Comment
Question by:radarhill
1 Comment
 
LVL 1

Accepted Solution

by:
radarhill earned 0 total points
ID: 36596877
Found a way to make this happen myself:
		if ($this->Event->softDelete( $id )) {
			$this->Session->setFlash( 'Event deleted', true );
			$this->redirect( array( 'action' => 'index/restoreID:'.$id ) );
		}

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now