Home  >  Article  >  Backend Development  >  php 排序 嵌套在html中的有关问题

php 排序 嵌套在html中的有关问题

WBOY
WBOYOriginal
2016-06-13 12:16:071027browse

php 排序 嵌套在html中的问题
这个排序代码写出来了 怎么才能把他嵌套在html中  实现点击页面按钮就能排序


//排序
(strtolower($_GET['sort'])=="asc")?$sort="desc":$sort="asc";
unset($surl['orderby'],$surl['sort']);
$orderUrl = http_build_query($surl);
if($_GET['orderby']){
//if(strtolower($_GET['orderby'])=="leve") $parm['orderby'] = "m.credits ".text($_GET['sort']);
if(strtolower($_GET['orderby'])=="rate") $parm['orderby'] = "b.borrow_interest_rate ".text($_GET['sort']);
elseif(strtolower($_GET['orderby'])=="borrow_money") $parm['orderby'] = "b.borrow_money ".text($_GET['sort']);
else $parm['orderby']="b.id DESC";
}else{
$parm['orderby']="b.borrow_status ASC,b.id DESC";
}


$Sorder['Corderby'] = strtolower(text($_GET['orderby']));
$Sorder['Csort'] = strtolower(text($_GET['sort']));
$Sorder['url'] = $orderUrl;
$Sorder['sort'] = $sort;
$Sorder['orderby'] = text($_GET['orderby']);
//排序         
        $list = getBorrowList($parm);
        //dump(M()->GetLastsql());exit;
        $this->assign("Sorder",$Sorder);
$this->assign("searchUrl",$searchUrl);
        $this->assign("searchMap",$searchMap);
        $this->assign("Bconfig",$Bconfig);
        $this->assign("Buse",$this->gloconf['BORROW_USE']);
        $this->assign("list",$list);
        $this->display();
    }

------解决思路----------------------
把排序条件传递回来就可以了。
有两种方式,表单的Post提交,或者URL里带参数,根据提交来的数据来判断排序方式就行了。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn