0

私のワードプレスのインストールには、大量のデータを保存するテーブルがあります。テーブルでクエリを実行し、適切にフィルター処理された行の選択を返すことができるphpファイルがあります。ユーザーが mysql クエリ変数に対応するさまざまな値を選択できるフォームが自分のワードプレス ページにあります。フォームで選択した値を使用するようにphpファイルを取得するにはどうすればよいですか?

私のフォームは以下を使用しています:

<input type="text" name="max_price" />
<input type="text" name="loan_fraction" />
<input type="text" name="interest_rate" />
<input type="text" list="state" />

どのような種類の送信アクションが必要かはよくわかりませんが、これらの値を次のように使用する php に渡したいと思います。

$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");

ここで、some_number は、loan_fraction と interest_rate の関数です。

ありがとう :)

4

1 に答える 1

1

php ファイルを指すようにアクションを設定し、フィールド名を php の変数に割り当てるだけで動作するように見えました。

HTML の場合:

<td>
  <form id="buy_prop" action="http://****_data.php" method="post">How much are you willing to spend?
</td>
<td>
    <input type="text" name="max_price" id="max_price">
</td>

PHPで

$max_price = $_POST["max_price"];    
$loan_fraction = $_POST["loan_fraction"];
etc etc
于 2013-11-18T14:21:06.123 に答える