Jump to content

Mixing PHP and HTML


monkeybidz

Recommended Posts

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
Share on other sites

<?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
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.