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>



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire