I am trying to construct URL for 'search' method in Laravel, and to pass multiple parameters from selected dropdown choices. I have 4 dropdown lists, and I am trying to pass parameters like this, but it doesn't work, it says Undefined index: country , so how can I accomplish this?
<a href="{{ URL::to('/search',array($_POST['country'],$_POST['lokacija'],$_POST['prodajaizdavanje'],$_POST['vrsta']), false) }}"> <input id="Search" type="submit" value="Traži" /> </a>
Of course I have dropdowns defined like follow:
<select name="country"> ..some options.. </select>
You need a form, with your input into it:
<form method="get" action="/search">
<select name="country">
Your options
</select>
<input type="submit" value="search" />
</form>
And you will be able to access your choices in your search route
Just make sure your form is using GET method.
<form method="GET" action="/search">
Other fields comes here
<input type="submit" value="search" />
</form>
And you can access the input using $_GET['variable_name']
And don't forget the to generate the token or otherwise Laravel will throw an error.