根据下拉框值分页

西凉董卓 无业游民  2010-07-10 09:44:37
$page = empty($_GET['page'])?1:intval($_GET['page']);
if($page<1) $page=1;
$perpage = 1;
$perpage = mob_perpage($perpage);
$start = ($page-1)*$perpage;
//检查开始数
ckstart($start, $perpage);
if($_GET['works'])
{
switch($_POST["time"]){
case 7:
$time=time()-60*60*24*7;
$time=">".$time;
break;
case 14:
$time=time()-60*60*24*14;
$time1=time()-60*60*24*7;$time2=time()-60*60*24*15;
$time=" between ".$time2." and ".$time1;
break;
case 15:
$time=time()-60*60*24*15;
$time="<=".$time;
break;
}
$title=array();
if($time=="")
{
$time1=time()-60*60*24*7;
$time=">".$time1;
$zp=$_SGLOBAL['db']->query("select * from ".tname("fbcontent")." where uid='$_SGLOBAL[supe_uid]' and title!='' limit 0,6");
$count=$_SGLOBAL['db']->result($_SGLOBAL['db']->query("select count(*) from ".tname("fbcontent")." where uid='$_SGLOBAL[supe_uid]' and title!=''"),0);echo $count;
}
else
{
$zp=$_SGLOBAL['db']->query("select * from ".tname("fbcontent")." where uid='$_SGLOBAL[supe_uid]' and title!='' and datetime$time limit $start,$perpage");
$count=$_SGLOBAL['db']->result($_SGLOBAL['db']->query("select count(*) from ".tname("fbcontent")." where uid='$_SGLOBAL[supe_uid]' and title!='' and datetime$time limit $start,$perpage"),0);
}
while($zptitle=$_SGLOBAL['db']->fetch_array($zp))
{
$title["title"]=$zptitle["title"];
$title["content"]=substr($zptitle["content"],0,40)."......";
$title["datetime"]=date("Y-m-d",$zptitle["datetime"]);
$title["id"]=$zptitle["id"];
$title["uid"]=$zptitle["uid"];
$title1[]=$title;
}
}
$multi1 = multi($count, $perpage, $page, "space.php?uid=$_SGLOBAL[supe_uid]&do=share&view=article&works=work", '', 'comment_ul');
$multi1是分页的,$_POST["time"]是下拉框的值提交过来的
请问一下,根据下拉框的值,对这个值的数据库内容进行分面。如何实现
...全文
50 点赞 收藏 6
写回复
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
kyzy_yy_pm 2010-07-10
你可以将你到后台的select值再通过赋值方式到模板,在模板中判断$page得几就让几被选中
回复
woshiguozhongbin 2010-07-10
你要获取你的page值
然后和下拉框的值进行对比 如果相同就让他选中...
回复
西凉董卓 2010-07-10
为什么我点击下一页,OPTION里的值又变成默认值了。而不是我点击分页的一页的OPTION值
回复
kyzy_yy_pm 2010-07-10
类似于
<select id="select" onchange="page(this)">
<option value="1">1页</option>
<option value="2">2页</option>
<option value="3">3页</option>
</select>

<script>
function page(select){
location.href = "page.php?p=" + document.getElementById("select").value;
}
</script>
回复
kyzy_yy_pm 2010-07-10
将平时点击的链接页数通过下拉框的select标签的value的onchange时间传递给后台就行了,其他的操作一样的
回复
发动态
发帖子
基础编程
创建于2007-09-28

2.1w+

社区成员

从PHP安装配置,PHP入门,PHP基础到PHP应用
申请成为版主
社区公告
暂无公告