i am trying to adapt what you have told me so far I have done this
in page1.php is the form I have appended like this
Code:
<form name="frmSearch" class="abajo" action="indexpagination.php?strZipCode=<?php echo $strZipCode; ?>&strName=<?php echo $strZipCode; ?>&strState=<?php echo $strState; ?>" method="post">
in page indexpagination.php I get the value with the $_REQUEST global variable
PHP Code:
$strName = isset($_REQUEST['frmSearch']['name'])?mysql_real_escape_string($_REQUEST['frmSearch']['name']):'';
$strZipCode = isset($_REQUEST['frmSearch']['zipcode'])?mysql_real_escape_string($_REQUEST['frmSearch']['zipcode']):'';
$strState = $_REQUEST['frmSearch']['state']/*)*/;
$arrFoodTypes = isset($_REQUEST['frmSearch']['food_types'])?mysql_real_escape_string($_REQUEST['frmSearch']['food_types']):array();
$arrOfferings = isset($_REQUEST['frmSearch']['offerings'])?mysql_real_escape_string($_REQUEST['frmSearch']['offerings']):array();
Then get this comparinson at the query
PHP Code:
$query4 = "SELECT state, zip, county
FROM restaurants
WHERE
(zip='$strZipCode')";
and the paging links are appended like this
PHP Code:
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=1&strZipCode=". $strZipCode . "' ><<</a> ";
// get previous page num
$prevpage = $currentpage - 1;
// show < link to go back to 1 page http_build_query( $strName,$strZipCode, $strState, $arrFoodTypes, $arrOfferings)
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$prevpage&strZipCode=". $strZipCode . "'><</a> ";
} // end if
// loop to show links to range of pages around current page
for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) {
// if it's a valid page number...
if (($x > 0) && ($x <= $totalpages)) {
// if we're on current page...
if ($x == $currentpage) {
// 'highlight' it but don't make a link
echo " [<b>$x</b>] ";
// if not current page...
} else {
// make it a link http_build_query( $strName,$strZipCode, $strState, $arrFoodTypes, $arrOfferings)
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$x&strZipCode=". $strZipCode . "'>$x</a> ";
} // end else
} // end if
} // end for
// if not on last page, show forward and last page links
if ($currentpage != $totalpages) {
// get next page
$nextpage = $currentpage + 1;
// echo forward link for next page http_build_query( $strName,$strZipCode, $strState, $arrFoodTypes, $arrOfferings)
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$nextpage&strZipCode=". $strZipCode . "'>></a> ";
// echo forward link for lastpage http_build_query( $strName,$strZipCode, $strState, $arrFoodTypes, $arrOfferings)
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$totalpages&strZipCode=". $strZipCode . "'>>></a> ";
} // end if
?>
The problem stills persist. When link on one of the paging links it links the user to the second page of rows and the url is
Code:
http://localhost/stores/indexpagination.php?currentpage=2&strZipCode=01561
and it will still display this
Instead of:
County:Woscester
State:MA
Zip Code:01561
The this display above is this script
PHP Code:
$query4 = "SELECT state, zip, county
FROM restaurants
WHERE
(zip='$strZipCode')";
$result = mysql_query($query4);
$arrstate = mysql_fetch_array($result);
echo '<div class="information"><label>County:</label>
<div>'. $arrstate['county']. '</div>
<label>State:</label>
<div>'. $arrstate['state']. '</div>
<label>Zip Code:</label>
<div>'. $arrstate['zip']. '</div></div> <br><br>';
Bookmarks