Fractaliste
Fractaliste

Reputation: 5957

How to redirect with custom parameters?

I'm building a form. When the user submit the form, data are saved into the db, then the user is redirected to the same form with:

return $app->redirect('/admin/edit/user/' . $message);

The message variable is a message about the success or failure of the DB job.

But this solution doesn't suit me best... Is it possible to do the same with passing the $message variable as a POST parameter ? I don't want it appears into the URL...

Upvotes: 0

Views: 656

Answers (1)

Paweł Kolanowski
Paweł Kolanowski

Reputation: 342

You can do this by:

return $this->redirect($this->generateUrl('route_name', array('param1' => 'foo', 'param2' => 'bar')));

But... look at this: http://symfony.com/doc/current/book/controller.html#flash-messages

Upvotes: 3

Related Questions