Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

symfony 1.4 how to get POST parameters?

I can get a parameter('id' for example) by $request->getParameter('id');

but if I use a form to POST the id, how could I get its value? $request->getParameter('id'); doesn't work.

like image 554
Peter Long Avatar asked Aug 20 '10 15:08

Peter Long


2 Answers

sfWebRequest has getPostParameter(name, default)

like image 185
Raoul Duke Avatar answered Nov 19 '22 13:11

Raoul Duke


In the Form, the Post Parameter Name is (by default): Model[colum name]

For example:

<input type="text" id="user_email" name="user[email]">

In the Action (after post):

$request->getPostParameter('user[email]');

Note: $request is the type sfWebRequest

like image 36
Fernando Avatar answered Nov 19 '22 12:11

Fernando