In my Laravel app I have created a sidebar where I have links like
/buy?state=NY or /buy?area=Queens
to let the user select a State or Area
I also have a form that lets Users Filter various things like rating, genre. When i click on the Filter button, the url changes to something like
buy?min_year=1880&max_year=2019&min_rating=1&max_rating=10&genre=horror
it drops the ?state=NY or ?area=Queens
from the URL
I want to I change in the action to append the current URL parameters to the Filter string
I have tried
$url = Request::path();
if (isset($_GET["state"]) && !empty($_GET['state'])) {
$state = $_GET['state'];
$url = $url . "&state=". $state;
}
if (isset($_GET["council"]) && !empty($_GET['council'])) {
$council = $_GET['council'];
$url = $url . "&council=". $council;
}
if (isset($_GET["area"]) && !empty($_GET['area'])) {
$area = $_GET['area'];
$url = $url . "&area=". $area;
And then in my filter form
{{ Form::open(array('url' => $url, 'class' => 'form-inline', 'method' => 'GET')) }}
but this results in the form returning this string.
/buystate=NY?min_year=1880&max_year=2019&min_rating=1&max_rating=10&genre=horror
when I want
/buy?state=NY&min_year=1880&max_year=2019&min_rating=1&max_rating=10&genre=horror