doune1000 2011-01-19 06:52
浏览 23
已采纳

如何在搜索中添加其他关键字?

<form action="search.php" method="post" class="search" id="search">
     <input name="search" id="search" type="text" value=""><br>
</form>
...
echo ".urlencode($_POST['search']).";

here is my basic search box. I want: 1. open the page first, the ".urlencode($_POST['search'])." is empty. 2. when the client type some word and make a search, the ".urlencode($_POST['search'])." will always add a additional keyword after client type word.

for example, when the client type: apple, the ".urlencode($_POST['search'])." part show: apple20%juice, when the client type: orange, the ".urlencode($_POST['search'])." part show: orange20%juice, it always add a additional keyword 20%juice behind the key word.

How to reach this one? Thanks.

  • 写回答

2条回答 默认 最新

  • drq61040 2011-01-19 07:00
    关注

    like this:

    check if the search is set first if so go ahead and grab the string and add juice to it

    if(isset($_POST['search']))
    {
      $searchterm = $_POST['search']." juice";
      //follw by other stmts...
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部