i recently added a pagination script to my search script which uses a dropdown menu for user inputs for the search. the pagination displays the first page alright but the following pages are all blank, I think it has to do with linking the pagination to the dropdown search but I dont know how to go about it or if am wrong plz point me in the right direction. I get my error message to select from dropdown
this is my script below
[php]<?php
error_reporting(E_ALL);
//records shown
$per_page = 10;
//current_page
if (!isset($_GET[‘page’]))
{
$page = 1;
}else
{
$page = $_GET[‘page’];
}
$search = empty($_GET[‘search’])? die ("<font size=‘5’font color=’#FF0E0E’>ERROR: Enter Search Criteria") : mysql_real_escape_string($_GET[‘search’]);
$dropdown = empty($_GET[‘dropdown’])? die ("<font size=‘5’font color=’#FF0E0E’>ERROR: Select from Dropdown") : mysql_real_escape_string($_GET[‘dropdown’]);
//mysql start pagination
if ($page<=1)
$start = 0;
else
$start = $page * $per_page - $per_page;
//Server Variables
$host = “localhost”;
$user = “root”;
$pass = “erhun”;
$db = “books”;
//Open Connection
$connect = mysql_connect($host, $user, $pass) or die (“Unable to connect to host”);
//Select Database
mysql_select_db($db) or die (“Unable to connect to database”);
//Create Query
$sql = “SELECT DISTINCT book_id,call_no,main_title,author1,itm_type,publdate,image,subj1 FROM records WHERE $dropdown LIKE ‘%$search%’ order by publdate” or die (mysql_error());
//how much records returned
@$num_rows = mysql_num_rows(mysql_query($sql));
//no of pages in all
$num_pages = ceil($num_rows / $per_page);
//Append limit for shown records
$sql .= " LIMIT $start, $per_page";
//show all records
$result = mysql_query($sql) or die (mysql_error());
while($row = mysql_fetch_array($result)) {
echo $row[‘main_title’]. “
”;
}
//prev, numbers, next links
$prev = $page - 1;
$next = $page + 1;
echo “
”;
//prev
if($prev > 0)
echo "prev ";
//next
if($page < ceil($num_rows / $per_page))
echo "next ";
?>
[/php]
[code]
SLAMONLINE ACCESS CATALOG
Search By... Title Author Subject[/code]