I have a HTML Form with Drop Down options which pass the values to php sql query I have on the same page as the form. This works if I use the values with LIKE statements but when I try to use the posted values with BETWEEN or >= it doesnt work. If i try with the actual values it does work. Could someone advise on what I am doing wrong. I have posted my HTML Form with the PHP code for the SQL Query.
HTML:
<html><form action="#" method="GET"></select>
<select name="MinPrice">
<option value="">Min Price</option>
<option value="">No Min</option>
<option value="500">£500</option>
<option value="600">£600</option>
<option value="700">£700</option>
<option value="800">£800</option>
<option value="900">£900</option>
<option value="">Show All</option>
</select>
<select name="MaxPrice">
<option value="">Max Price</option>
<option value="">No Max</option>
<option value="500">£500</option>
<option value="600">£600</option>
<option value="700">£700</option>
<option value="800">£800</option>
<option value="900">£900</option></select></form></html>
PHP:
<?php
mysql_connect("****", "****", "****");
mysql_select_db("****");
$sql = mysql_query("SELECT * FROM Product WHERE Price >= '%$_GET[MinPrice]%'");
echo "<h3>...Something...";
Or
<?php
mysql_connect("****", "****", "****");
mysql_select_db("****");
$sql = mysql_query("SELECT * FROM Product WHERE Price BETWEEN '%$_GET[MinPrice]%' AND '%$_GET[MaxPrice]%'");
echo "<h3>...Something...";
i dont get any results back, but if i exchange the GET Values with actual numbers it works as I want. Anyone got any suggestions on this?
I have tried absolutely everything I know