I have a search feature where users can search a database. All works
very well except for one small annoying bug.
If a user searches for anything using wildcards and the '%' is the
FIRST character searched for, my pagination routine doesn't pass the
correct value.
Say the user enters %300. The page displays the correct data for the
first page, indicates that it is page 1 of 11 and when the NEXT link is
clicked, the value changes to 00. I haven't figured out why the %3
drops, however I suspect it may be my use of quotes. Particular code is
below. Can anyone help me?
Platform is Apache on FC3, MySQL and PHP. Browser being used doesn't
matter.
<?
if($pageno == 1) {
echo "<TD CLASS=upperLinks>FIRST </TD><TD
CLASS=upperLinks>PREV </TD>";
echo "<TD CLASS=data1>FIRST </TD><TD CLASS=data1>PREV </TD>";
} else {
echo "<TD CLASS=data1> <A
HREF='{$_SERVER['PHP_SELF']}?pageno=1&searchfor=$searchfor&searchtype=$search type'
CLASS=upperLinks>FIRST</A></TD>";
$prevpage = $pageno - 1;
echo "<TD CLASS=data1> <A
HREF='{$_SERVER['PHP_SELF']}?pageno=$prevpage&searchfor=$searchfor&searchtype =$searchtype'
CLASS=upperLinks>PREV</A></TD>";
}
?>
<TD CLASS=data1>(Page <?=$pageno?> of <?=$lastpage?>) </TD>
<?
if ($pageno == $lastpage) {
echo "<TD CLASS=data1>NEXT </TD><TD CLASS=data1>LAST </TD>";
} else {
$nextpage = $pageno + 1;
echo "<TD CLASS=data1> <A
HREF='{$_SERVER['PHP_SELF']}?pageno=$nextpage&searchfor=$searchfor&searchtype =$searchtype'
CLASS=upperLinks>NEXT</A></TD>";
echo "<TD CLASS=data1> <A
HREF='{$_SERVER['PHP_SELF']}?pageno=$lastpage&searchfor=$searchfor&searchtype =$searchtype'
CLASS=upperLinks>LAST</A></TD>";
Thanks
rk