dimanche 5 mai 2019

laravel 5.8 append new search query param to url

I have a side bar that have some forms to search in my products.

I want in sorting section if user click on sort by lowprice button, new query param append to current url to search again by lowprice

I want to turn this

http://example.com/search/site?search=productname

into

http://example.com/search/site?search=productname&sortprice=lowprice

according to some answer (below code) I used this but it redirect me to http://example.com/search/site url.



This is my current form:

<form id="sort-p" action="" method="get">
    <div>
        <div class="text-muted"> price sort</div>
        <i class="fas fa-sort-amount-down"></i>
        <div class="btn-group btn-group-sm product-sort" role="group" aria-label="Basic example">
            <button type="button" onclick="document.getElementById('sort-p').submit();" class="btn waves-effect shadow-none btn-sm">
                low
            </button>
            <button type="button" class="btn waves-effect shadow-none btn-sm">
                hight
            </button>
        </div>
    </div>
    </div>



from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2ZZiC7m
via IFTTT

Aucun commentaire:

Enregistrer un commentaire