monkeybidz Posted February 19, 2008 Share Posted February 19, 2008 I was wondering if there is a way to insert the following code into another section without cuasing errors. Here is the code I need to insert: <?php if($hours < 24){ $listing = "<FONT FACE=ARIAL COLOR=GREEN><B>Listed Today</B></FONT>"; } if($hours > 0 && $hours < 1){ $listing = "<FONT FACE=ARIAL COLOR=GREEN><B>Just Listed</B></FONT>"; } ?> I need to have inside this define var: $TPL_last_auctions_value becuase this var gets information for several rows and result through another query. Each line has different hours and the end result should be $listing. Here is the code where I need to insert it into: <?php $TPL_last_auctions_value .=" <table width=\"100%\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td width=\"10%\" align=\"center\"><p style=\"background-color:$bgcolor;display:block\"><center>".$listing."</center></td> <td align=\"left\"> $city_details1, $state1</B> - to - <B>$city_details2, $state2</B><BR> <A HREF=\"./item.php?id=$id\">"; ?> If I put it outside, it works, but gives me the same result for all rows. Link to comment https://forums.phpfreaks.com/topic/91806-mixing-php-and-html/ Share on other sites More sharing options...
sKunKbad Posted February 19, 2008 Share Posted February 19, 2008 <?php $TPL_last_auctions_value .=" <table width=\"100%\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td width=\"10%\" align=\"center\"><p style=\"background-color:$bgcolor;display:block\"><center>"; if($hours < 24){ $TPL_last_auctions_value .= "<FONT FACE=ARIAL COLOR=GREEN><B>Listed Today</B></FONT>"; } if($hours > 0 && $hours < 1){ $TPL_last_auctions_value .= "<FONT FACE=ARIAL COLOR=GREEN><B>Just Listed</B></FONT>"; } $TPL_last_auctions_value .= "</center></td> <td align=\"left\"> $city_details1, $state1</B> - to - <B>$city_details2, $state2</B><BR> <A HREF=\"./item.php?id=$id\">"; ?> Link to comment https://forums.phpfreaks.com/topic/91806-mixing-php-and-html/#findComment-470283 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.