Jump to content

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

Link to comment
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>";
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.