Jump to content


Photo

blank return on search need to post window page


  • Please log in to reply
6 replies to this topic

#1 bladechob

bladechob
  • Members
  • PipPipPip
  • Advanced Member
  • 99 posts
  • LocationDerby, UK

Posted 25 September 2006 - 01:57 PM

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
To forgive is to forget... to forget is... what was I saying?

#2 gerkintrigg

gerkintrigg
  • Members
  • PipPipPip
  • Magician
  • 828 posts
  • LocationBristol, UK
  • Age:37

Posted 25 September 2006 - 02:18 PM

try window.open (javascript command)
Neil Trigger - http://www.ghostlypublishing.co.uk - Ghostly Publishing - Children's Fantasy Books

#3 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 25 September 2006 - 02:21 PM

if (mysql_num_rows($result) == 0) {
  echo "tough not available but click <a href='mailto:foo@foo.com'>here</a> for further help";
}

Is that what you mean?

#4 bladechob

bladechob
  • Members
  • PipPipPip
  • Advanced Member
  • 99 posts
  • LocationDerby, UK

Posted 25 September 2006 - 02:38 PM

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
To forgive is to forget... to forget is... what was I saying?

#5 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 25 September 2006 - 02:41 PM

Well you could redirect them to a new page....

if (mysql_num_rows($result) == 0) {
  header("Location: emptysearch.php");
}

Or put all the code for your page within the if. eg;

if (mysql_num_rows($result) == 0) {
?>
<!-- put your page in here -->
<?php
}


#6 bladechob

bladechob
  • Members
  • PipPipPip
  • Advanced Member
  • 99 posts
  • LocationDerby, UK

Posted 25 September 2006 - 02:57 PM

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.cimnet...ions.com/<?echo $r["graphic"];?>" border="0">
                            <?}
else{?>
<img src="http://images.cimnet....com/nopic.jpg" border="0">
<?}?>
</td>
<td align=right><b><?echo $r["name"]?>

  <?if ($country=='GB'){?>
  <a href="http://www.multimap....ddr3=&pc=<?echo $postcode?>&quicksearch=tn33+9eu&cidr_client=none" target=map>Map</a></b><?}?>

                            <?/*if ($country=='BE'){?>
  <a href="http://www.multimap....ddr3=&pc=<?echo $postcode?>&quicksearch=tn33+9eu&cidr_client=none" target=map>Map</a></b><?}*/?>

                            <?if ($country=='FR'){?>
  <a href="http://www.mapquest....ity=&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>
To forgive is to forget... to forget is... what was I saying?

#7 bladechob

bladechob
  • Members
  • PipPipPip
  • Advanced Member
  • 99 posts
  • LocationDerby, UK

Posted 25 September 2006 - 03:12 PM

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'); ?>&nbsp;</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....ddr3=&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....ity=&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>&nbsp;</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?>"> &#163;<?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!
To forgive is to forget... to forget is... what was I saying?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users