Peter Long
Peter Long

Reputation: 4012

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.

Upvotes: 6

Views: 24611

Answers (2)

Fernando
Fernando

Reputation: 1124

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

Upvotes: 4

Raoul Duke
Raoul Duke

Reputation: 4301

sfWebRequest has getPostParameter(name, default)

Upvotes: 16

Related Questions