PHP snippet not working inside html background tag
Posted: Sat Jul 07, 2007 3:30 pm
Hello,
I have a background image stored in a field called background and it shows up fine on a page using the following:
I have made various attempts to assign that variable as the background in an html table, but no matter what I try, the image will not show up. Here are some of the things I have tried that have not worked:
Then, I tried:
I also tried escaping php except for the variable itself:
<td width="100%" background="">
Then finally I repeated the latter approach but after using the htmlentities function:
">"
I'm a php newbie, however I'm puzzled because it seems to me that most of the ploys I've tried above have worked for me in other circumstances --
So thanks in advance for any ideas on what I'm doing wrong.
Brian
I have a background image stored in a field called background and it shows up fine on a page using the following:
Code: Select all
echo $row['background'];Code: Select all
echo "<td width='100%' background='".$row['background']."'>";Then, I tried:
Code: Select all
$FixedBack = htmlentities($row['background']);
echo "<td width='100%' background='".$FixedBack."'>";I also tried escaping php except for the variable itself:
<td width="100%" background="
Code: Select all
<?php echo $row['background'] ?>Then finally I repeated the latter approach but after using the htmlentities function:
Code: Select all
$FixedBack = htmlentities($row['background']);
?>
<td width="100%" background="<?php echo $FixedBack ?>I'm a php newbie, however I'm puzzled because it seems to me that most of the ploys I've tried above have worked for me in other circumstances --
So thanks in advance for any ideas on what I'm doing wrong.
Brian