$pageNumber=(isset($_POST["page"]) && is_numeric($_POST["page"])) ? $_POST["page"] :1;
$perPage = 10;
$padding = 5;
$startIndex = ($pageNumber * $perPage) - $perPage;
$testsearch = $_POST['search'];
$totalCount = "select * from student_adv where name like '%$_POST[search]%'";
$rsCount = mysql_query($totalCount, $conn) or die(mysql_error());
$rowCount = mysql_num_rows($rsCount);
print "<div align=\"center\">";
$numOfPages= ceil( $rowCount / $perPage);
print "<a href=\"result.php?page=1\">FIRST</a>";
print "</div>";
$sql = "select id, name from student_adv where name like '%$_POST[search]%' order by id limit $startIndex, $perPage";
$rs = mysql_query($sql, $conn) or die(mysql_error());
if ( mysql_num_rows($rs) > 0 )
{
while ($row = mysql_fetch_object($rs))
{
print "<div>";
print $row->id;
print ": ";
print $row->name;
print "</div>";
}
}
else
{
print "sorry!! no rows";
}
I am taking input from a form and getting result into the pagination(result.php)
so the search i give is
Code:
$totalCount = "select * from student_adv where name like '%$_POST[search]%'";
my pagination works fine when i hard code the valie of $_POST[search] as John or similar..
but when i go to the next page i get the error as
"Notice: Undefined index: search in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\result.php on line 56"
i tried putting the value of $_POST[search] in hidden variable-it did not work.
I know there is a way out-but wots it- any body got any idea???
is the problem because of $_POST[search] or there could be some other problem?
Thanks for help in advance...
Scooter!!