时间:2021-07-01 10:21:17 帮助过:11人阅读
这是什么写法,数组里面foreach ? 能行吗?
这写法闻所未闻啊
  我就是想做一个多表单搜索,  
 就是给搜索同时限制多个条件,每个条件各用一个表单的形式,  
 有单行文本框,也有下拉菜单,可以不同时限制全部条件,  
 这个不知道怎么做 
  为什么要多表单,一个表单里,多个搜索条件不行吗???  
  
 
  不就是过滤掉无效(空值)的传入项吗?  
  
$w = array_diff($_POST, array('', 0));    xuzuning !  
 你就是我的大神,崇拜你崇拜的五体投地 
  if (!empty($_POST['num']) ||  
 !empty($_POST['names']) ||  
 !empty($_POST['price']) ||  
 !empty($_POST['years']) ||  
 !empty($_POST['season']) ||  
 !empty($_POST['groups']) ||  
 !empty($_POST['note']) )  
 {  
  
  
  
 $w = array_diff($_POST, array('', 0));}  
  
 //分页参数,路由配合  
 $config['base_url'] = 'http://localhost/ci/index.php/product/search';  
 $num = $this->product_model->search_page( $w);//这里调用时说$w没定义  
 $config['total_rows'] = $num;   
 $config['per_page'] = 80;  
 $config['uri_segment'] = '3';  
 $this->pagination->initialize($config);  
  
 $pageNum=$this->uri->segment(3,1);  
 if($pageNum==1){  
 $offset=0;  
 }else{  
 $offset=$config['per_page']*($pageNum-1);  
 }//分页参数结束  
  
 $data['title'] = '商品中心';  
 // $_where = array('type' => 'newstore');  
 $data['data'] = $this->product_model->search_paging($w,$config['per_page'],$offset);//这里也说$w没定义 
$w = array();if($_POST) {  $w = array_diff($_POST, array('', 0));}//分页参数,路由配合.....  高手高手高高手
感谢xuzuning对我们这些小鸟的帮助