Adding Backgroundimage depending on PHP variable
Posted: Tue Apr 22, 2008 2:30 pm
Hi,
I have two images image 1 and image 2. I want to insert image 1 as background when a variable test =1 otherwise the image 2 needs to be inserted. I wrote the following code for it.
However none of the background image is displayed.
Please help me with this.
Thanks
I have two images image 1 and image 2. I want to insert image 1 as background when a variable test =1 otherwise the image 2 needs to be inserted. I wrote the following code for it.
Code: Select all
<?PHP
if ($test==1)
echo "<td width='50%' valign='top' STYLE=' background-image: url('img/image1.jpg');' >";
else
echo "<td width='50%' valign='top' STYLE= ' background-image: url('img/image2.jpg');' >";
?>
Please help me with this.
Thanks