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条)

报告相同问题?

悬赏问题

  • ¥40 图书信息管理系统程序编写
  • ¥15 7-1 jmu-java-m02-使用二维数组存储多元线性方程组
  • ¥20 Qcustomplot缩小曲线形状问题
  • ¥15 企业资源规划ERP沙盘模拟
  • ¥15 树莓派控制机械臂传输命令报错,显示摄像头不存在
  • ¥15 前端echarts坐标轴问题
  • ¥15 ad5933的I2C
  • ¥15 请问RTX4060的笔记本电脑可以训练yolov5模型吗?
  • ¥15 数学建模求思路及代码
  • ¥50 silvaco GaN HEMT有栅极场板的击穿电压仿真问题