OK I am sending you the rest of my code
and thanks for your help with this
Here is the HTML page containing the form
<form name ="search" id ="search" action = buying_2.php method=GET>
<p align="left" class="style24">Search >>> </p>
<p align="left">
<span class="style8"> Location:</span>
<select name=location value="<? if(isset($GET['location'])) echo $GET['location']; ?>" >
<option value=Canterbury>Canterbury
<option value=Whitstable>Whitstable
<option value=Herne Bay>Herne Bay
<option value=Faversham>Faversham
</select>
</p>
<p align="left"> <span class="style8">Price range:</span>
<select name=price_range value="<? if(isset($GET['price_range'])) echo $GET['price_range']; ?>" >
<option value=£100,000 to £200,000>£100,000 to £200,000
<option value=£200,000 to £300,000>£200,000 to £300,000
<option value=£300,000 to £400,000>£300,000 to £400,000
<option value=£400,000 to £500,000>£400,000 to £500,000
<option value=£500,000 to £600,000>£500,000 to £600,000
<option value=£600,000 to £700,000>£600,000 to £700,000
<option value=£700,000 to £800,000>£700,000 to £800,000
<option value=£800,000 to £900,000>£800,000 to £900,000
<option value=£900,000 to £1000,000>£900,000 to £1000,000
<option value=£1000,000 and Above>1000,000 and Above
</select>
</p>
<p align="left">
<span class="style8">Property type:</span>
<select name=property_type value="<? if(isset($GET['property_type'])) echo $GET['property_type']; ?>">
<option value=House>House
<option value=Flat>Flat
<option value=Rented>Rented
</select>
<input name="Submit" type = submit value = "Search" tabindex="3" >
</p>
<p align="left"> </p>
</span>
</form></td>
Here is the php page that collects user data from the form on the html page
<?php
include("dbinfo_2.inc.php");
// Connect to contact database
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
// create variables to hold users input from form
$new_location = $GET['location'];
$new_price_range = $GET['price_range'];
$new_property_type = $_GET['property_type'];
if ($new_location=="")
{
$new_location='%';
}
if ($new_price_range=="")
{
$new_price_range='%';
}
if ($new_property_type=="")
{
$new_property_type='%';
}
// If current page number, use it
// if not, set one!
if(!isset($GET['page'])){
$page = 1;
} else {
$page = $GET['page'];
}
// Define the number of results per page
$max_results =4;
// Figure out the limit for the query based
// on the current page number.
$from = (($page * $max_results) - $max_results);
// Perform MySQL query on only the current page number's results
$result = mysql_query ("SELECT * FROM sellers_properties WHERE location LIKE '$new_location%' AND price_range LIKE '$new_price_range%' AND property_type LIKE '$new_property_type%' LIMIT $from, $max_results");
// Find out how total rows for query
$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM sellers_properties WHERE location LIKE '$new_location%' AND price_range LIKE '$new_price_range%' AND property_type LIKE '$new_property_type%'"),0);
?>
<?
if ($row=mysql_fetch_array($result)){
do{
?>
//here is all my formatted data to show results
<?
// Space between tables
//print("<p>");
}
while ($row = mysql_fetch_array($result));
}
// Let user know if no matching data found
/
else print "<script>document.location.href='no_results.htm'</script>";
//I know the above should use Header location instead of javascript
// Figure out the total number of results in DB:
//$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM sellers_properties WHERE location LIKE '$new_location%' AND price_range LIKE '$new_price_range%' AND property_type LIKE '$new_property_type%'"),0);
// Figure out the total number of pages. Always round up using ceil()
$total_pages = ceil($total_results / $max_results);
//Have tested all of above and works fine truble starts below...
// Build Page Number Hyperlinks
echo "<center>Select a Page<br />";
// Build Previous Link
if($page > 1){
$prev = ($page - 1);
// echo "<a href=\"".$SERVER['PHP_SELF']."?page=$prev\">Previous</a> ";
echo '<a href="'.$SERVER['PHP_SELF'].'?page=' .$prev. '&new_location='.$GET['location'].'&new_price_range='.$GET['price_range'].'&new_property_type='.$GET['property_type'].'">prev</a>';
//echo'<a href="buying_2.php?page='.$prev.'&new_location='.$GET['location'].'&new_price_range='.$GET['price_range'].'&new_property_type='.$GET['property_type'].'">PREVIOUS</a> ';
}
for($i = 1; $i <= $total_pages; $i++){
if(($page) == $i){
echo "$i ";
} else {
echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$i\">$i</a> ";
// echo '<a href="buying_2.php?page='.$i.$new_location, $new_price_range, $new_property_type.'">$i</a>';
}
}
// Build Next Link
if($page < $total_pages){
$next = ($page + 1);
// echo "<a href=\"".$SERVER['PHP_SELF']."?page=$next\">Next>></a>";
echo '<a href="'.$SERVER['PHP_SELF'].'?page=' .$next. '&new_location='.$GET['location'].'&new_price_range='.$GET['price_range'].'&new_property_type='.$GET['property_type'].'">next</a>';
//echo'<a href="buying_2.php?page='.$prev.'&new_location='.$GET['location'].'&new_price_range='.$GET['price_range'].'&new_property_type='.$GET['property_type'].'">NEXT</a> ';
}
echo "</center>";
?>
Hope this helps
Your help is much appreciated
Simplecat