bladechob Posted September 25, 2006 Share Posted September 25, 2006 Hi, I got a very good reply to an earlier posted query on displaying a message when an sql query returns blank: i.e.if (mysql_num_rows($result) == 0) { echo "We are sorry but the dates you have selected are either being provisionally held or not available. </a>. Thank you."; }However, what I really need to ask is what is the code string to open up a php page which allows a little editing on it, like I would like to add into a mailto ref in the text which an echo won't allow me to do. Bottom line is I want to display a message saying tough not available but click here for further help.Thanks Quote Link to comment Share on other sites More sharing options...
gerkintrigg Posted September 25, 2006 Share Posted September 25, 2006 try window.open (javascript command) Quote Link to comment Share on other sites More sharing options...
trq Posted September 25, 2006 Share Posted September 25, 2006 [code=php:0]if (mysql_num_rows($result) == 0) { echo "tough not available but click <a href='mailto:foo@foo.com'>here</a> for further help";}[/code]Is that what you mean? Quote Link to comment Share on other sites More sharing options...
bladechob Posted September 25, 2006 Author Share Posted September 25, 2006 not really what I need to happen is that when the search returns as blank that it opens a new php page with a few bits and bobs on it saying sorry but no availability and click the link to send off an email to the person who can deal with it. Putting the ahref link into the echo does not seem to work. Thanks your help is much appreciated Quote Link to comment Share on other sites More sharing options...
trq Posted September 25, 2006 Share Posted September 25, 2006 Well you could redirect them to a new page....[code=php:0]if (mysql_num_rows($result) == 0) { header("Location: emptysearch.php");}[/code]Or put all the code for your page within the if. eg;[code=php:0]if (mysql_num_rows($result) == 0) {?><!-- put your page in here --><?php}[/code] Quote Link to comment Share on other sites More sharing options...
bladechob Posted September 25, 2006 Author Share Posted September 25, 2006 Thanks for that (again) but it's still not behaving. This is the page code as it stands now - I just need a message flag to come up to say not available because etc and then a link to a mail address. <form action="index.php" method="get"> <input type="hidden" name="content" value="process"> <input type="hidden" name="location" value="<?//echo $location ?>"> <input type="hidden" name="hotel2" value="<?echo $hotel?>"> <input type="hidden" name="hotel" value="<? echo $r["name"]?>"> <input type="hidden" name="arrives[0]" value="<?echo $arrives[0]?>"> <input type="hidden" name="arrives[1]" value="<? echo $arrives[1]?>"> <input type="hidden" name="country" value="<? echo $country?>"> <input type="hidden" name="brand" value="All"> <input type="hidden" name="days" value="<?echo $days?>"> <input type="hidden" name="rooms" value="<?echo $rooms?>"> <input type="hidden" name="roomtype" value="<?echo $roomtype?>"> <table summary="" border="0" width=500> <tr> <td rowspan=4 valign=top> <?if ($graphic!=''){?> <img src="http://images.cimnetsolutions.com/<?echo $r["graphic"];?>" border="0"> <?} else{?> <img src="http://images.cimnetsolutions.com/nopic.jpg" border="0"> <?}?> </td> <td align=right><b><?echo $r["name"]?> <?if ($country=='GB'){?> <a href="http://www.multimap.com/map/browse.cgi?client=public&db=pc&addr1=&client=public&addr2=&advanced=&addr3=&pc=<?echo $postcode?>&quicksearch=tn33+9eu&cidr_client=none" target=map>Map</a></b><?}?> <?/*if ($country=='BE'){?> <a href="http://www.multimap.com/map/browse.cgi?client=public&db=pc&addr1=&client=public&addr2=&advanced=&addr3=&pc=<?echo $postcode?>&quicksearch=tn33+9eu&cidr_client=none" target=map>Map</a></b><?}*/?> <?if ($country=='FR'){?> <a href="http://www.mapquest.fr/cgi-bin/ia_find?link=btwn%2Ftwn-map_results&random=318&event=find_search&uid=u7x6hah508g7x9ha%3A25dutxuaaw&country=Great+Britain&SNVData=&address=&city=&Zip=<?echo $postcode?>&country=France&Find+Map.x=32&Find+Map.y=11" target=map>Map</a></b><?}?> <?if ($kcflag=='2'){?> <br><img src="images/smileysparkle.gif" width="32" height="32"> <?}?> </td> </td> </tr> <tr> <td align=right><? echo $r["notes"]?><br><br></td> </tr> <tr> <td align=right><b> <?$query2 = "select ratename, rate, notes from venue_rates where hotelid='$hotelid' and (ratename='Corporate rate' or ratename='Rack rate' or ratename='$company') " ; $result2= mysql_db_query("$db", $query2); while ($r2= mysql_fetch_array($result2)) { ?> <?echo $r2["ratename"]?> - <?echo $r2["rate"]?><br> <?echo $r2["notes"]?><br> <?}?> <?echo $terms?><br> All rates quoted are in <?echo $rx["currency"];?> </b></td> </tr> <tr> <td align=right><input type="submit" value="Rate Details"></td> </tr> </table></form> Quote Link to comment Share on other sites More sharing options...
bladechob Posted September 25, 2006 Author Share Posted September 25, 2006 sorry got that wrong. The code in question is:<form action="index.php?content=reg1" method="post"> <input type="hidden" name="online" value="yes" > <input type="hidden" name="location" value="<?echo $location?>" > <input type="hidden" name="hotelselect" value="<? echo$r["hotelid"]?>" > <input type="hidden" name="rooms" value="<? echo$rooms?>" > <input type="hidden" name="arrives" value="<? $newarrive=$arrives[0].$arrives[1]; echo$newarrive?>" > <input type="hidden" name="days" value="<? echo$days?>" > <input type="hidden" name="alloname" value="<?echo $r["alloname"]?>" > <table summary="" border="0" width=80%> <tr> <td width="49" rowspan=3 valign=top><?php include('propertySubMenu.php'); ?> </td> <td width="76" rowspan=3 valign=top><img src="http://images.cimnet.co.uk/<?echo $r["graphic"];?>" border="0"></td> <td width="555" align=right><span class="style5"><b><? echo $r["name"]?> <?if ($country=='UNITED KINGDOM'){?> <a href="http://www.multimap.com/map/browse.cgi?client=public&db=pc&addr1=&client=public&addr2=&advanced=&addr3=&pc=<?echo $postcode?>&quicksearch=tn33+9eu&cidr_client=none" target=map>Map</a></b> <?}?> <?if (($country=='FRANCE') or ($country=='France') ){?> <a href="http://www.mapquest.fr/cgi-bin/ia_find?link=btwn%2Ftwn-map_results&random=318&event=find_search&uid=u7x6hah508g7x9ha%3A25dutxuaaw&country=Great+Britain&SNVData=&address=&city=&Zip=<?echo $postcode?>&country=France&Find+Map.x=32&Find+Map.y=11" target=map>Map</a></b> <?}?> <input type="hidden" name="hotel" value="<? echo $r["name"]?>"> <?if ($kcflag=='2'){?> <br> <img src="images/smileysparkle.gif" width="32" height="32"> <?}?> </span></td> </tr> <tr> <td align=right><div align="left" class="style7"><span class="style8"><? echo $r["notes"]?><br> <br> </span></div></td> </tr> <tr> <td align=right> </td> </tr> <tr> <td align=right colspan=3><span class="style9"> <?$query2 = "select ratename, rate, notes from venue_rates where hotelid='$hotelid' and (ratename='$company' ) " ; $result2= mysql_db_query("$db", $query2); while ($r2= mysql_fetch_array($result2)) { ?> <?echo $r2["ratename"]?> - <?echo $r2["rate"]?><br> <?echo $r2["notes"]?><br> <?}?> The rate displayed is the property rental charge for the dates you have selected during the seasonal period, exclusive of supplements. <select name="rateselect"> <?//$query2 = "select ratename, rate, notes from venue_rates where hotelid='$hotelid' and ratename like '%Southern Sun Resorts%' " ;// Sep 7 2006 - JK@FL - fields are referenced by name when the result is used, so it's safe to add another, namely allorate and days$query2="select abacus.days,abacus.allorate,abacus.alloname,abacus.rate, venue_main.name from abacus, venue_main where 1 and abacus.year='$year' and abacus.days like '%$dayssql%' and venue_main.hotelid='$hotelid' and abacus.roomtype='$roomtype' and abacus.hotelid=venue_main.hotelid and abacus.alloname like '%$company%'"; if(!$result2= mysql_db_query("$db", $query2)){echo mysql_error();} while ($r2= mysql_fetch_array($result2)) { // work out the rate and use that instead of the default $t_rate = sum_rates($dayssql, $r2["days"], $r2["allorate"]); ?> <option value="<?echo $t_rate?>"> £<?echo $t_rate ?> - <?echo $r2["alloname"]?></option> <?}?> </select> <br> <br> <?echo $terms?><br> All rates quoted are in <?echo $rx["currency"];?> <input type="hidden" name="terms" value="<?echo $terms?>"> <br> </span></td> </tr> <tr> <td align=right colspan=3><input type="submit" value="Rate Details"></td> </tr> </table> </form>The problem is that the unavailable message is coming back irrespective of whether there is availability or not! Quote Link to comment 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.