phplee Posted June 17, 2004 Share Posted June 17, 2004 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 Quote Link to comment Share on other sites More sharing options...
Bza Posted June 17, 2004 Share Posted June 17, 2004 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>"; ?> 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.