我創建PHP搜索表單我要顯示在搜索變量名的URL我的URL像這樣的http://本地主機/ ZBLOG /結果/ 1 /我想這樣的網址http://localhost/zblog/results/1/xxcxcxc這是我的代碼<?php $search = $_POST["search"];?><form action="<?php echo $url; ?>results/1/<?php echo $search; ?>" method="post" name="search" id="searchthis" style="display:inline;"><input id="search-box" name="search" size="40" type="text" placeholder="what are you looking for............"/> <input id="search-btn" value="search" type="submit"/></form>
1 回答
UYOU
TA貢獻1878條經驗 獲得超4個贊
您需要將form方法更改為method =“ get”并檢查$ search獲得正確的值。
<?php
$search = $_GET["search"];
?>
<form action="<?php echo $url; ?>results/1/<?php echo $search; ?>" method="get" name="search" id="searchthis" style="display:inline;">
<input id="search-box" name="search" size="40" type="text" placeholder="what are you looking for............"/>
<input id="search-btn" value="search" type="submit"/>
</form>
- 1 回答
- 0 關注
- 99 瀏覽
添加回答
舉報
0/150
提交
取消
