I need you help to solve the following situation.
I have search form that our user can use to search our database.
What I need is to pass the search variable in the url, so that I can retrieve it for my paginator.
Here is the code so far: the problem with this code is that when I press the search button some time it take into account the echo and some times I have to select a second time for it to register the echo.
I presume it is because I am using $_REQUEST
which can be interpreted as $_GET
and/or $_POST
.
What is the best practice and how can I achieve the result?
<form name="search_m" method="post" action="index.php?pg=result&a=<?php echo $_REQUEST['agency'];?>&pt=<?php echo $_REQUEST['property_type'];?>&pm=<?php echo $_REQUEST['property_market_status'];?>&tl=<?php echo $_REQUEST['type_listing'];?>&cp=<?php echo $_REQUEST['cp'];?>&r=<?php echo $_REQUEST['ref'];?>" >
<select name="agency" class="styled-select">
<option value=""> Select an Agent </option>
<option value="remax"> Remax </option>
</select>
<select name="property_type" class="styled-select">
<option selected="selected" value="">Select Property Type</option>
<option value="1">Condo/Apartment</option>
<option value="2">House</option>
<option value="3">Land</option>
<option value="4">Farm</option>
<option value="5">Residential Farm</option>
<option value="6">Garage</option>
<option value="7">Yield property</option>
<option value="8">Maisonette / Duplex</option>
</select>
<select name="property_market_status" class="styled-select">
<option selected="selected" value="">Market Status:</option>
<option value="1">Foreclosure</option>
<option value="2">Coming Soon</option>
<option value="3">New Build</option>
<option value="4">Re-Built /Makeover</option>
<option value="5">Used</option>
<option value="6">Best Deal</option>
<option value="7">In Auction</option>
</select>
<select name="type_listing" class="styled-select">
<option selected="selected" value="">Business:</option>
<option value="Rent"> Rent </option>
<option value="Sell"> Sell </option>
<option value="Holiday Rental"> Holiday Rental </option>
</select>
<select name="district" class="styled-select">
<option value=""> district </option>
</select>
<select name="concelho" class="styled-select">
<option value=""> concelho </option>
</select>
<select name="freguesia" class="styled-select">
<option value=""> freguesia </option>
</select>
<input class="textbox" type="text" name="cp" size="30px" placeholder="Postal Code:"/>
<input class="textbox" type="text" name="ref" size="30px" placeholder="Ref:"/>
<select name="order_by" class="styled-select">
<option value=""> Sort: ... </option>
<option value=""> Sort: Agency </option>
<option value=""> Sort: Location </option>
<option value=""> Sort: More expensive </option>
<option value=""> Sort: Cheapest price </option>
</select>
<input type="submit" class="css_button" name="lista" value="Search">
</form>
Thanks in advance