Jump to content

Archived

This topic is now archived and is closed to further replies.

phplee

echo <?php ?>

Recommended Posts

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

Share this post


Link to post
Share on other sites

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>";
?>

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.