I have put a search facility on my site and managed to do the search by postcode and distance, which then displays a list of restaurants within that postcode area. I would like to link this list of restaurants so that people can view the restaurant's menu.
The menus at the moment are selected from a drop down selection for city, then street, then the restaurant, which then displays the menu within a table - but I would like to display a link to the restaurant's menu from the postcode search results (rather then from the results of using the drop down selections). I have included the code below.
Can anyone help or point me in the right direction please.
Thank you kindly.
BigFoot_3000
***** PLEASE USE THE CODE TAG WHEN POSTING SOURCE CODE *****
Code: Select all
<?
include "config/conf.php";
require_once ("js/xajax_core/xajax.inc.php");
$rid2=$_GET['id']; //Got the restaurant id from the searched by postcode
if ($_REQUEST['rid']) {
$rsr=getSqlRow("SELECT id,cityid,streetid FROM rests WHERE id=".remSpecialChars($_REQUEST['rid'])."");
$_SESSION['cityid2']=$_SESSION['cityid'];
$_SESSION['streetid2']=$_SESSION['streetid'];
$_SESSION['restid2']=$_SESSION['id'];
}
$xajax = new xajax();
//$xajax->setFlag('debug', true);
$xajax->registerFunction("setCity");
$xajax->registerFunction("setRests");
$xajax->registerFunction("setRestoran");
$xajax->registerFunction("addCart");
$xajax->registerFunction("delCart");
$xajax->registerFunction("updateCart");
$xajax->registerFunction("updateCartOptionals");
$xajax->registerFunction("Pay");
$xajax->registerFunction("setFavori");
$xajax->configure('statusMessages',false);
$xajax->configure('waitCursor', false);
$xajax->processRequest();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title><?=SITE_NAME?></title>
<? include "inc/styles.php";
$xajax->printJavascript($GLOBALS['mainpath']."js/"); ?>
<link type="text/css" media="screen" rel="stylesheet" href="js/colorbox/colorbox.css" />
<script type="text/javascript" src="js/colorbox/jquery.colorbox-min.js"></script>
<script type="text/JavaScript">
function adding_cart(show,hide) {
document.getElementById(show).style.display = "block";
document.getElementById(hide).style.display = "none";
}
function setImg() {
//$("a[rel='product_img']").colorbox();
$("a[rel='product_img']").colorbox({transition:"fade"});
}
</script>
</head>
<body>
<?
include "inc/header.php";
?>
<div id="content">
<div id="container">
<h1 class="h1" id="titleh1"><?=MSG_SELECT_STREET?></h1>
<div class="divleft">
<form id="myform" name="myform" method="post" action="javascript:void(null);">
<div id="streets" class="divsearch" style="width:300px">
<select name="streetid" id="streetid" style="width:285px;font-size:15px;" onchange='xajax_setRests(this.value); xajax.$("titleh1").innerHTML="<?=MSG_SELECT_REST?>"; return false;'>
<option value=""><?=MSG_SELECT_STREET?></option>
<?
$totalStreets = getSqlNumber("SELECT id FROM streets where cityid=".$_SESSION['cityid']."");
$getRs = mysql_query("SELECT * FROM streets where cityid=".$_SESSION['cityid']." order by street asc");
while ($rsi = mysql_fetch_array($getRs)) {
$totalRest = getSqlNumber("SELECT id FROM rests WHERE streetid=".$rsi['id']."");
if ($totalRest>0) {
$streetid=$rsi['id'];
$countStreets++;
?>
<option value="<?=$rsi['id'];?>" <? if ($_SESSION['streetid']==$rsi['id'] || $totalStreets==1) echo "selected"; ?>><?=$rsi['street'];?></option>
<? }
}
if ($countStreets==1) $totalStreets=1;
?>
</select>
</div>
<div id="div_rests" class="divsearch" style="width:250px"></div>
</form>
<div style="margin-top:10px;"> </div>
<div id="div_rest" style="width:585px;">
<div style="text-align:left; padding-top:20px;">
<?=MSG_WELCOME?>
</div>
</div>
</div>
<?
if ($totalStreets==1) {
?>
<script>
xajax.$("streetid").value=<?=$streetid?>;
loading('div_rest');
xajax_setRests(<?=$streetid?>);
</script>
<? }
if ($_REQUEST['rid']) {
?>
<script>
xajax.$("streetid").value=<?=$_SESSION['streetid']?>;
loading('div_rest');
xajax_setRests(<?=$_SESSION['streetid']?>);
xajax_setRestoran(<?=$rsr['id']?>);
</script>
<? }
if ($_SESSION['restid'] && !$rsr['id'])
{
?>
<script>
loading('div_rest');
xajax_setRestoran(<?=$_SESSION['restid']?>);
</script>
<? } ?>
<div class="divright">
<?=Date("d/m/Y H:i")?>
<div id="div_cart" style="clear:both;">
<? include("inc/cart.php"); ?>
</div>
</div>
</div>
</div>
<? include "inc/footer.php"; ?>
</body>
</html>