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 Link to comment https://forums.phpfreaks.com/topic/1873-echo/ 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>"; ?> Link to comment https://forums.phpfreaks.com/topic/1873-echo/#findComment-6103 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.