Try this as an example and using Symfony2.8
Look:
<form action="{{ path('connection') }}" method="post" name="formulario_login">
<label for="username">User:</label>
<input type="text" id="username" name="_username" value="" />
<br />
<label for="password">Password:</label>
<input type="password" id="password" name="_password" />
<br />
<input type="checkbox" id="remember_me" name="_remember_me"/>
<label for="remember_me">Remember me</label>
<br />
<input type="submit" name="login" value="Login" />
</form>
controller:
public function connectionAction(Request $request) {
$username = $request->request->get('_username');
$password = $request->request->get('_password');
....
}
Another way to get the parameters, as you see, is not entirely intuitive:
$request->query->get('name');
$request->request->get('name');
source
share