I send some data by POST.
For example: http://.../?tag[]=1&tag[]=2
I cant receive tag varible in controller, I tried to do something like this:
$this->get('request')->get('tag');
But I receive null.
Whats wrong?
I send some data by POST.
For example: http://.../?tag[]=1&tag[]=2
I cant receive tag varible in controller, I tried to do something like this:
$this->get('request')->get('tag');
But I receive null.
Whats wrong?
If you are sending data as you mentioned via URL, it is a GET request.
public function exampleAction(Request $request)
{
$tagPost=$request->request->get('tag'); //from $_POST[]
$tagGet=$request->query->get('tag'); //from $_GET[]
var_dump($tagPost,$tagGet);
}
try:
$this->get('request')->request->get('tag');
instead of:
$this->get('request')->get('tag');
EDIT: IF you http method is GET (instead of POST), you can try with:
$this->get('request')->query->get('tag');
Check here for further detail
hope this help