473,386 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

add background image

Hi,

I have 2 background images.
Ineed to add the first image if the value of variable test is 1 otherwise i need to add the second background image.

I have written the following code:
Expand|Select|Wrap|Line Numbers
  1. <?PHP
  2.                if ($test ==1)
  3.                echo "<td width='50%' valign='top'  STYLE='background-image: url('img/table_faoback.jpg');'>";
  4.                else
  5.                echo "<td width='50%' valign='top'  STYLE='background-image: url('img/table_back.jpg');'>";
  6.  
  7.                ?>
  8.  
  9.  
However it does not display any image. Please let me know how to do this.

Thanks.
Apr 22 '08 #1
7 2820
Markus
6,050 Expert 4TB
Hi,

I have 2 background images.
Ineed to add the first image if the value of variable test is 1 otherwise i need to add the second background image.

I have written the following code:
Expand|Select|Wrap|Line Numbers
  1. <?PHP
  2.                if ($test ==1)
  3.                echo "<td width='50%' valign='top'  STYLE='background-image: url('img/table_faoback.jpg');'>";
  4.                else
  5.                echo "<td width='50%' valign='top'  STYLE='background-image: url('img/table_back.jpg');'>";
  6.  
  7.                ?>
  8.  
  9.  
However it does not display any image. Please let me know how to do this.

Thanks.
Check your source code: is there <td width='... printed out?

If so: this is not a php problem: it is echoing through the conditional statement and your problem lies in the html!

regards
Apr 22 '08 #2
nomad
664 Expert 512MB
Hi,

I have 2 background images.
Ineed to add the first image if the value of variable test is 1 otherwise i need to add the second background image.

I have written the following code:
Expand|Select|Wrap|Line Numbers
  1. <?PHP
  2.              if ($test ==1)
  3.              echo "<td width='50%' valign='top' STYLE='background-image: url('img/table_faoback.jpg');'>";
  4.              else
  5.              echo "<td width='50%' valign='top' STYLE='background-image: url('img/table_back.jpg');'>";
  6.  
  7.              ?>
  8.  
  9.  
However it does not display any image. Please let me know how to do this.

Thanks.

You might try this...
background-image: url(img/table_back.jpg);

Also you need to look at your html coding as well as markusn00b suggested. Something is not right with the ;

nomad
Apr 22 '08 #3
Markus
6,050 Expert 4TB
You might try this...
background-image: url(img/table_back.jpg);

Also you need to look at your html coding as well as markusn00b suggested. Something is not right with the ;

nomad
It may be the single quotes within single quotes that are causing the problem.
Apr 22 '08 #4
ronverdonk
4,258 Expert 4TB
You should at least escape the single quotes within the single quotes in this statement[php]STYLE='background-image: url('img/table_faoback.jpg');'>";[/php]Ronald
Apr 22 '08 #5
ronverdonk
4,258 Expert 4TB
Markus you beat me again!

Ronald
Apr 22 '08 #6
Markus
6,050 Expert 4TB
Markus you beat me again!

Ronald
That's just how i get down

8]

You've been slacking ron!
Where you been?
Apr 22 '08 #7
ronverdonk
4,258 Expert 4TB
That's just how i get down

8]

You've been slacking ron!
Where you been?
Very busy with making some websites.

Ronald
Apr 24 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: erik | last post by:
Is it posssible to inherit the previous pages (parent pages) background image? Is there a script out there I could look at? Thanks
2
by: Markus Mohr | last post by:
Hi, everyone, I have a special problem: For every monitor resolution in 200 pixel steps from 800 to 1600 pixels I have an image to be shown as centered background-image. Those images all...
27
by: Kevin Yu | last post by:
When I declare on HTML page <LINK href="mycss.css" type="text/css" rel=stylesheet /> .... <BODY class=myclass> in mycss.css BODY { FONT-WEIGHT: bold; FONT-SIZE: 12px; FONT-FAMILY:...
13
by: Giggle Girl | last post by:
Hi there, I need to use a background image in a TR that does NOT restart everytime it hits a TD. Can it be done? Specifically, if you set a background image for an entier table, now mater how...
7
by: Nilesh | last post by:
I am using background-image attribute in a CSS file and linking the CSS file to aspx page. But strangly, background-image attribute is not working for relative URL. e.g. If I apply following css...
3
by: Viken Karaguesian | last post by:
Hello all, I need somehelp with background tiling. I have a sneaking suspicion that what I want to do is not possible, but I'll ask anyway. :>) First some background: Here's the site in...
2
by: Patrick | last post by:
Hi All, I am trying more and more to incorporate CSS into my work here. I have currently been playing around with fluid design and tableless layout. Currently I am trying to make a background...
6
by: Rob | last post by:
Hello, I'm sure this has come up before. I have need for a collection of all elements/objects in an HTML document that have any kind of an attribute (HTML or CSS) that is making use of a URL to...
16
by: stevedude | last post by:
CSS newbie again. I have a problem trying to get coffee mug images within anchor tags to center with my link text for a vertical list menu. If I use the horizontal/vertical properties of...
2
by: thephatp | last post by:
I'm having a problem with IE rendering correctly. I'm experimenting with using all div's in my pages now, and I'm not very familiar with the quirks of IE. I have created a sample page, and I'm...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.