Jump to content


Photo

echo <?php ?>


  • Please log in to reply
1 reply to this topic

#1 phplee

phplee
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 17 June 2004 - 10:27 AM

hi, i need some help to get php to work in an echo, i have this to display a list of hotels by there star rating, this is the code i have...

$text = ("<p>
<font face='Verdana' size='2'><img src='http://www.mydomain.com/photos/$Hotel_Id/AAB$Hotel_Id.jpg' alt='$Establishment_Name' width='100' height='75'><br>
<a href='$Home_Hyperlink'>$Establishment_Name</a><br>
$Address1 $Address2 $Town $Post_Code<br>
$Description<br>
Click here to book the <a href='$Bookings_Hyperlink'>$Establishment_Name</a><br>
This hotel has a $AA_Rating Star AA rating, and a $RAC_Rating star RAC rating</font>
</p><br>
");


but some of them dont have a star rating so i want to put an if statement arround them, here is the code i tried but it does not show up when i upload it?
...
This hotel has a <?php if ($AA_Rating == '0') {
echo 'this hotel does not have a AA rating';
} else {
echo '$AA_Rating '
?>
</font>
</p><br>
...

the same for rac, i dont know if explained this enough, recap... this is a php page and i want to put more php in it (shown above)

any help much appreciated!!!!!
regards phplee

#2 Bza

Bza
  • Members
  • Pip
  • Newbie
  • 2 posts

Posted 17 June 2004 - 10:38 AM

Try this:
<?php
$text = ("<p>
<font face='Verdana' size='2'><img src='http://www.mydomain.com/photos/$Hotel_Id/AAB$Hotel_Id.jpg' alt='$Establishment_Name' width='100' height='75'><br>
<a href='$Home_Hyperlink'>$Establishment_Name</a><br>
$Address1 $Address2 $Town $Post_Code<br>
$Description<br>
Click here to book the <a href='$Bookings_Hyperlink'>$Establishment_Name</a><br>");
if($AA_Rating == '0') {
$text .= "This hotel does not have a AA rating, ";
} else {
$text .= "This hotel has a $AA_Rating, ";
}
if)$RAC_Rating == '0') {
$text .= "and no RAC rating.";
} else {
$text .= "and a $RAC_Rating star RAC rating.";
}
$text .="</font></p><br>";
?>

Bza[br]BzaBlog




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users