Redirect to edit after add in controller

Hi all new to this forum and CakePHP so don’t shoot me!

I’ve created a app using oven CakePHP V4.0.2 and baked my crud using cmd so all good so far :slight_smile: now I’m a bit stuck on how when I add new topic to my database on table how to redirect to a page depending on content posted?

I have a radio button set in my form to select either Fishing or Tackle what I would like to do is depending on what is selected:

if fishing is selected load /fishing
else load /tackle

how do I do this in my controller or add form I’ve been trying to find something in the documents but don’t know what to search

any help appreciated



In your controller, after the save is successful, add a condition that looks at the posted data, and return $this->redirect(...) depending on the value.

Hi Zulura,

Thanks I got it working… :slight_smile: