doune1000 2011-01-19 14: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 15: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条)

报告相同问题?

悬赏问题

  • ¥15 BP神经网络控制倒立摆
  • ¥20 要这个数学建模编程的代码 并且能完整允许出来结果 完整的过程和数据的结果
  • ¥15 html5+css和javascript有人可以帮吗?图片要怎么插入代码里面啊
  • ¥30 Unity接入微信SDK 无法开启摄像头
  • ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
  • ¥20 cad图纸,chx-3六轴码垛机器人
  • ¥15 移动摄像头专网需要解vlan
  • ¥20 access多表提取相同字段数据并合并
  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算