私はメソッドポストを持つフォームを持ち、テキストボックスと送信するボタンがあります。hrefに入力値を渡す方法
私は簡単に$_POST
で値を取得できますが、この値をリンクに渡すことができます。
のTextInput =検索用語
リンク= index.php?search=search term
私はちょうど私が$search
が$_POST
に設定されますので、値$検索が設定されていない取得のhrefにそれをconcoctenante場合。
私はこれが可能であることを知っていますが、idはむしろjavascriptを使用していませんが、ちょうどcss htmlとphpですが、wowhead.com
が例です。
ありがとうございます!フォームのメソッドを使用して
は、作品を得るが、それはまた、URL
<form action="search.php" method="get">
<table style="border:0px">
<tr>
<td style="border:0px">
<input id="search" name="search" autocomplete="off" type="text" maxlength="32" style="width:350px;" />
</td>
<td style="border:0px">
<input name="submit" type="submit" value="Search" style="font-size:16;padding:3px;" />
</td>
</tr>
</table>
</form>
に私のボタンの値を渡し、次のように現れる:私がして固定&submit=Search
を持っていたい
http://localhost/search.php?search=searchterm&submit=Search
変更する
<input name="submit" type="submit" value="Search" style="font-size:16;padding:3px;" />
$で試してみてください使用get
方法
<form action="index.php" method="GET">
<input type="search" name="search" />
<input type="submit" name="submit" />
</form>
OR
<form action="index.php" method="GET">
<input type="search" name="search" />
</form>
<input type="submit" value="Search" style="font-size:16;padding:3px;" />
で値をつかみます$ _POSTの代わりに_REQUEST ;-) –
を入力してくださいいくつかのコード –