2013-04-11 59 views
0

我試圖通過按鈕和文本框傳遞查詢字符串。 這樣我可以在文本框中輸入一些文字,然後點擊圖像按鈕。 然後該按鈕將通過在文本框中鍵入的內容並將其傳遞到下一頁。 我應該怎麼做呢?通過點擊從文本框輸入傳遞查詢字符串PHP HTML

下面是我的代碼:

<input type="text" name="search" class="resizedTextbox"> 
    <a href=page.php?productName=$_GET["search"]><img src="images/search-btn.gif"/></a> 

回答

4

試試這個:

<form method="GET" action="page.php"> 
<input type="text" name="search" class="resizedTextbox"> 
<input type="image" src="images/search-btn.gif"/> 
</form> 
+0

感謝它的工作。 – 2013-04-11 16:21:28

0

嘗試用Java腳本這

<form name="frm" method="get" action="page.php"> 
<input type="text" name="search" id="search"> 
<input type="submit" name="btnSearch" value="Search" onclick="location.href='http://www.website.com/index.php?search='+document.getElementById('search').value;" id="btnSearch" class="buttonSearch" /> 
</form> 

GET值和get方法傳遞。

相關問題