Solved

CakePHP setFlash - Can it pass a variable to view?

Posted on 2011-09-25
1
323 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

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…
This article discusses four methods for overlaying images in a container on a web page
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

773 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