I have a table in my wordpress install that stores a lot of data. I have a php file that can run a query on the table and return a nicely filtered selection of rows. I have a form on my wordpress page that allows users to select a variety of values corresponding to the mysql query variables. How do I get the php file to use the values selected in the form?
my form uses the following:
<input type="text" name="max_price" />
<input type="text" name="loan_fraction" />
<input type="text" name="interest_rate" />
<input type="text" list="state" />
I don't really know what sort of submit action I need but I want it to pass these values to my php that uses them like:
$values = mysql_query("select
b.listing, b.bed, b.bath, b.type, b.address, b.postcode, b.state, b.price, avg_rent
from
buy_items b
join
(SELECT
bed, bath, type, suburb, postcode, AVG(price) as avg_rent
FROM
rent_items
GROUP BY bed, bath , type , suburb , postcode) a ON a.bed = b.bed and a.bath = b.bath
and a.suburb = b.suburb
and a.postcode = b.postcode
and a.type = b.type
where
(b.price * some_number) < a.avg_rent
and b.price > 50000
and price < max_price
and b.state = state");
where some_number is a function of loan_fraction and interest_rate.
Thanks :)
$wpdb->queryto make database queries . for more info googlewordpress wpdb class