Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

salmankhan2482's avatar

how to hide query string from url bar

when i am trying to submit a form with the get request. the code of the form is given below

<form action="{{ url('properties') }}" class="hero__form v2 filter" method="get">
            <input type="text" name="keyword" id="country">
            <div id="extra_keywords" style="display: none;">
                <input id="city_id" name="city" >
                <input id="sub_city_id" name="subcity" >
                <input id="town_id" name="town" >
                <input id="area_id" name="area" >
            </div>
</form>

the url will become something like this http://127.0.0.1:8000/properties?keyword=+West+Bay&city=1&subcity=26&town=&area=

but i am trying to make my url in the url bar like this http://127.0.0.1:8000/properties or only those parameter should be shown which have data and not the null paramater

0 likes
5 replies
Tray2's avatar

Change the method to post or make the call using Javascript

salmankhan2482's avatar

@Tray2 with the post request the page refresh wont work mean the data passed in the request will disappear.

Snapey's avatar

That's the way GET requests work

Please or to participate in this conversation.