PHP多條件搜尋ShopNc執行個體

來源:互聯網
上載者:User

標籤:執行個體   val   cti   des   style   php   order   mode   intval   

控制器部分代碼:

  

 1   if (trim($_GET[‘keyword‘]) != ‘‘) { 2             //echo $_GET[‘search_type‘]; exit(); 3             switch ($_GET[‘search_type‘]) { 4                 case 0: 5                     $where[‘goods_id‘] = array(‘like‘, ‘%‘ . trim($_GET[‘keyword‘]) . ‘%‘); 6                     break; 7                 case 1: 8                     $where[‘goods_name‘] = array(‘like‘, ‘%‘ . trim($_GET[‘keyword‘]) . ‘%‘); 9                     break;10                 case 2:11                     $where[‘goods_serial‘] = intval($_GET[‘keyword‘]);12                     break;13             }14         }15         $goods_list = $model_goods->where($where)->page(8)->order(‘goods_addtime DESC‘)->select();

模板帳號:

 1   <form method="get" action=""> 2           <input type="hidden" name="act" value="goods_public" /> 3           <input type="hidden" name="op" value="goodsOp" /> 4           <select name="search_type" id=""> 5             <option value="0">商品ID</option> 6             <option value="1">商品名稱</option> 7             <option value="2">商品貨號</option> 8         </select> 9         <tr>10           <td></td>11           <td class="w160">12               <input type="text" class="text" name="keyword" value="<?php echo $_GET[‘keyword‘]; ?>"/>13           </td>14           <td class="tc w70">15               <label class="submit-border">16                   <input type="submit" class="submit" value="搜尋" />17               </label>18           </td>19       </tr>20   </form>

 

PHP多條件搜尋ShopNc執行個體

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.