bigfoot_3000 Posted February 12, 2010 Share Posted February 12, 2010 Hi, I have an online food ordering script. It finds the restaurant and displays it's menu by first selecting a drop down box for the City, then another for the Street/State and then a third drop down for the Restaurant itself. It is in PhP and Ajax, which then displays the result (menu of the restaurant) on the same page within a table. However, I have just added a 'find your nearest restaurant' script on a new page which searches by postcode within a distance and lists the retaurants within that circumference and displays the restaurant's details. I would like to be able to have a 'Vew Menu' button that will take the visitor to that restaurant's menu. But because the session is being used to select a city, select a street and select a restaurant, I am unable to attach a link to the restaurant's menu on the results of find your nearest restaurant page. Does anyone have any ideas to how I can go about doing this. I have included the code of how it find and displays the restaurant's menu below. Thank you and kind regards, BigFoot_3000 1. <? 2. include "config/conf.php"; 3. require_once ("js/xajax_core/xajax.inc.php"); 4. 5. 6. $rid2=$_GET['id']; //Got the restaurant id from the searched by postcode 7. 8. 9. if ($_REQUEST['rid']) { 10. $rsr=getSqlRow("SELECT id,cityid,streetid FROM rests WHERE id=".remSpecialChars($_REQUEST['rid']).""); 11. 12. $_SESSION['cityid2']=$_SESSION['cityid']; 13. $_SESSION['streetid2']=$_SESSION['streetid']; 14. $_SESSION['restid2']=$_SESSION['id']; 15. 16. 17. 18. } 19. 20. $xajax = new xajax(); 21. //$xajax->setFlag('debug', true); 22. $xajax->registerFunction("setCity"); 23. $xajax->registerFunction("setRests"); 24. 25. $xajax->registerFunction("setRestoran"); 26. $xajax->registerFunction("addCart"); 27. $xajax->registerFunction("delCart"); 28. $xajax->registerFunction("updateCart"); 29. $xajax->registerFunction("updateCartOptionals"); 30. $xajax->registerFunction("Pay"); 31. $xajax->registerFunction("setFavori"); 32. $xajax->configure('statusMessages',false); 33. $xajax->configure('waitCursor', false); 34. $xajax->processRequest(); 35. ?> 36. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 37. <html> 38. 39. <head> 40. <meta http-equiv="content-type" content="text/html; charset=utf-8" /> 41. <title><?=SITE_NAME?></title> 42. <? include "inc/styles.php"; 43. $xajax->printJavascript($GLOBALS['mainpath']."js/"); ?> 44. <link type="text/css" media="screen" rel="stylesheet" href="js/colorbox/colorbox.css" /> 45. <script type="text/javascript" src="js/colorbox/jquery.colorbox-min.js"></script> 46. <script type="text/JavaScript"> 47. function adding_cart(show,hide) { 48. document.getElementById(show).style.display = "block"; 49. document.getElementById(hide).style.display = "none"; 50. } 51. 52. function setImg() { 53. //$("a[rel=product_img]").colorbox(); 54. $("a[rel=product_img]").colorbox({transition:"fade"}); 55. } 56. </script> 57. </head> 58. 59. <body> 60. 61. <? 62. include "inc/header.php"; 63. 64. 65. 66. 67. ?> 68. 69. <div id="content"> 70. <div id="container"> 71. <h1 class="h1" id="titleh1"><?=MSG_SELECT_STREET?></h1> 72. <div class="divleft"> 73. <form id="myform" name="myform" method="post" action="javascript:void(null);"> 74. 75. <div id="streets" class="divsearch" style="width:300px"> 76. <select name="streetid" id="streetid" style="width:285px;font-size:15px;" onchange='xajax_setRests(this.value); xajax.$("titleh1").innerHTML="<?=MSG_SELECT_REST?>"; return false;'> 77. <option value=""><?=MSG_SELECT_STREET?></option> 78. <? 79. $totalStreets = getSqlNumber("SELECT id FROM streets where cityid=".$_SESSION['cityid'].""); 80. $getRs = mysql_query("SELECT * FROM streets where cityid=".$_SESSION['cityid']." order by street asc"); 81. while ($rsi = mysql_fetch_array($getRs)) { 82. $totalRest = getSqlNumber("SELECT id FROM rests WHERE streetid=".$rsi['id'].""); 83. if ($totalRest>0) { 84. $streetid=$rsi['id']; 85. $countStreets++; 86. ?> 87. <option value="<?=$rsi['id'];?>" <? if ($_SESSION['streetid']==$rsi['id'] || $totalStreets==1) echo "selected"; ?>><?=$rsi['street'];?></option> 88. <? } 89. } 90. 91. 92. 93. if ($countStreets==1) $totalStreets=1; 94. ?> 95. </select> 96. </div> 97. 98. <div id="div_rests" class="divsearch" style="width:250px"></div> 99. 100. </form> 101. 102. 103. 104. <div style="margin-top:10px;"> </div> 105. <div id="div_rest" style="width:585px;"> 106. <div style="text-align:left; padding-top:20px;"> 107. 108. <?=MSG_WELCOME?> 109. 110. </div> 111. 112. </div> 113. 114. </div> 115. 116. <? 117. if ($totalStreets==1) { 118. ?> 119. <script> 120. xajax.$("streetid").value=<?=$streetid?>; 121. loading('div_rest'); 122. xajax_setRests(<?=$streetid?>); 123. </script> 124. <? } 125. 126. if ($_REQUEST['rid']) { 127. ?> 128. <script> 129. xajax.$("streetid").value=<?=$_SESSION['streetid']?>; 130. loading('div_rest'); 131. xajax_setRests(<?=$_SESSION['streetid']?>); 132. 133. 134. xajax_setRestoran(<?=$rsr['id']?>); 135. </script> 136. <? } 137. if ($_SESSION['restid'] && !$rsr['id']) 138. 139. { 140. 141. 142. 143. ?> 144. <script> 145. loading('div_rest'); 146. xajax_setRestoran(<?=$_SESSION['restid']?>); 147. </script> 148. <? } ?> 149. 150. <div class="divright"> 151. <?=Date("d/m/Y H:i")?> 152. <div id="div_cart" style="clear:both;"> 153. <? include("inc/cart.php"); ?> 154. </div> 155. </div> 156. 157. 158. </div> 159. </div> 160. 161. 162. 163. <? include "inc/footer.php"; ?> 164. 165. 166. </body> 167. </html> Quote Link to comment https://forums.phpfreaks.com/topic/191918-help-with-displaying-a-restaurants-menu-from-a-postcode-search/ Share on other sites More sharing options...
CareZer Posted March 8, 2010 Share Posted March 8, 2010 I am experiencing the same problem as you bigfoot_3000. I have my restaurant and have some online reservations, ordering, etc. Can anyone help us in this problem? Quote Link to comment https://forums.phpfreaks.com/topic/191918-help-with-displaying-a-restaurants-menu-from-a-postcode-search/#findComment-1022864 Share on other sites More sharing options...
PFMaBiSmAd Posted March 8, 2010 Share Posted March 8, 2010 Since it is unlikely that your code or the problem that you need help with is exactly the same as the original poster's (OP), adding your question onto the end of his (unanswered) thread probably won't get you many more responses than the OP received. You need to A) Start your own thread for your problem, and B) ask a specific question about your code or an error your code is producing. Programming help forums can only address specific problems or questions, one at a time, in the few hundred words that would be written in the responses. As to the reason the OP did not get any responses. No one likely wanted to tackle the problem of figuring out which of the 167 lines of the posted code (which was posted with line numbers and not inside of the forum's tags, making it hard to read and unlikely for anyone to take, alter, and post a solution) was actually relevant to the problem and what the problem actually is (beyond here is my code, change it to do what I want.) Quote Link to comment https://forums.phpfreaks.com/topic/191918-help-with-displaying-a-restaurants-menu-from-a-postcode-search/#findComment-1022979 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.