php post,get和分页问题

来源:百度知道 编辑:UC知道 时间:2024/05/23 19:42:38
在我的搜索页面中有个text,里面放的是每页显示记录的条数,默认是5条;
当我搜索页面用get传值时,text中的值能传过去,比如text中输入3,每页就显示3条记录;
按下一页,每页也还是3条记录;
当我搜索页面用post传值时,text中的值只有刚传过去有效,比如text中输入3,第一页中就显示3条记录;
按下一页,每页又变成默认的5条记录了;
这是什么原因?
search.php:
<?php
require("../../config/setup.php");
require("$session_check_path");
require("$Function_getListArr");
require("$Myarray");
include($session_check_path);
$buffer=implode("",file($template_admin_searchdomain_path));
$str1=getListArr(implode($arr_zt1,","),0,0);
$str2=getListArr(implode($arr_type1,","),0,0);
$buffer=str_replace("{typeid_str1}",$str1,$buffer);
$buffer=str_replace("{typeid_str2}",$str2,$buffer);
$buffer=str_replace("{displaypg}",$pages,$buffer);
$buffer=str_replace("{man_domain}",$search_domain_path,$buffer);
$buffer=str_replace("{image_path}",$image_path,$buf

$page=10;//每页显示10条数据
if($b=$_GET["page"])
{
}
else
{
$b=0;
}
//以上是刚进入的时候没有page值,将$b赋予0
//$b作用是定位数组内的第N条数据
//显示数据也从$b开始循环显示
for(i=0;i<$page;i++)
{
echo "$arr[$b]</p>"; //输出$arr数组内第$b条数据
$b++; //$b累加(即输出数组内第1条/第2条/第3条....第10条数据/)
}

感觉应该是在你第二次按下一页的时候根本没有传递3过去,也就是$_POST没有接收到你要分页的3,所以就按默认的5来了。你检查一下看看。