简体   繁体   English

PHP分页后转到第二页后的变量

[英]php rid variable after go to 2nd page in pagination

I'm using php pagination in my webpage but after go to 2nd page with help of pagination php rid the variable which I REQUEST from the last page, and getting the error like, 我在网页中使用php分页,但是在分页的帮助下转到第二页后,php摆脱了我从最后一页请求的变量,并得到如下错误:

Undefined index: title_no in E:\........\page_name.php on line 7

but when I'm using static variable then its working fine, but in dynamic it's rid the variable after go to 2nd page, This is some code of pagination where I'm getting problem 但是当我使用静态变量时,它可以正常工作,但是在动态状态下,它转到第二页后就删除了该变量,这是我遇到问题的一些分页代码

ob_start();
@session_start();
include("connect.php");
$title_no=@$_REQUEST['title_no'];
$tbl_name="postadd";

$adjacents = 2;
$productQuery = " where visible='1' AND title_no='{$_REQUEST['title_no']}'";

$query = "SELECT COUNT(*) as num FROM $tbl_name $productQuery";
$total_pages_row = mysql_query($query);
$total_pages_num = mysql_fetch_assoc($total_pages_row);
$total_pages = $total_pages_num['num'];

$targetpage = "product_listing_working.php";    
$limit_val = @$_GET['pagesize'];
if($limit_val!='') {
    $limit = $limit_val;
} else {
    $limit = 3;     
}
$page = @$_GET['page'];
if($page) 
    $start = ($page - 1) * $limit;          
else
    $start = 0;

$sql = "SELECT * FROM $tbl_name $productQuery LIMIT $start, $limit";
$result = mysql_query($sql);

Please guide me where I'm going wrong 请指导我我要去哪里了

Thanks in advance 提前致谢

try using 尝试使用

$title_no=@$_GET['title_no'];

EDIT 1 编辑1

Try this also 也尝试一下

$title_no=@$_GET['title_no'];
var_dump($_GET);//get all variables sent to GET
$tbl_name="postadd";

$adjacents = 2;
$productQuery = " where visible='1' AND title_no='.$title_no.'";//changed concataination to a cleaner way

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM