I setup a dropdown box to house data retrieved from MYSQL database in a file called "Test01.php". It worked OK.
Then I wrote another page called "Test01detail.php" and to get the selected option and based on that option I retrieve records from database. It worked OK.
However, when I tried to separate and view these records in different pages (10 records per page). I can only see result from the first page, nothing was shown on following pages.
Please Kindly look at the codes below and point out any mistakes. Thank you very much in advance.
Thanks.
Test01.php
<Form name="City" method="POST" action="Test01detail.php">
<select name="Cityselect">
<?
include_once("Connectdb.php");
$query=mysql_query("Select * from City ORDER BY CityID");
while ($result=mysql_fetch_array($query))
{
?>
<option value="<? echo $result["CityName"]; ?>"><? echo $result["CityName"]; ?></option>
<?
}
?>
</select>
<input type="submit" name="Submit" value="Check" />
</Form>
Test01detail.php
<?php
include_once("Connectdb.php");
$city = $_POST["Cityselect"];
$query = mysql_query("select * from ShopInfo, City Where shopcity=CityID AND CityName='$city' Group by ShopID");
$totalrows=mysql_num_rows($query);
$show=ceil($totalrows/10);
echo " Total record:".$totalrows."<br>";
echo "Please select Page No:";
for ($i=1;$i<=$show;$i++)
{
echo "<a href=Test01detail.php?page=$i>$i</a>,";
}
echo "<br>;
$page=$_GET["page"];
if (empty($page))$page=1;
$start=10($page-1);
$sql="select from ShopInfo, City Where shopcity=CityID AND CityName='$city' Group by ShopID limit $start, 10";
$result=mysql_query($sql);
while($record=mysql_fetch_array($result))
{
echo $record["ShopName"]."<br>";
echo $record["ShopAddress"]."<br>";
echo $record["ShopTel"]."<br>";
echo $record["OpenHours"]."<br>";
}
?>