根据下拉框值分页

西凉董卓 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"]是下拉框的值提交过来的
请问一下,根据下拉框的值,对这个值的数据库内容进行分面。如何实现
...全文
94 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
kyzy_yy_pm 2010-07-10
  • 打赏
  • 举报
回复
你可以将你到后台的select值再通过赋值方式到模板,在模板中判断$page得几就让几被选中
Abin-2008 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时间传递给后台就行了,其他的操作一样的

21,893

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧