Making a picture background in my php script...

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
No0b
Forum Commoner
Posts: 37
Joined: Tue Feb 07, 2006 6:17 pm

Making a picture background in my php script...

Post by No0b »

I need help making a background in my table... I know this is html and your probly going to give me some poo about it but i don't really care. this is the code i got

Code: Select all

$msg = "<table width=\"477\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\" bordercolorlight=\"#CCCCCC\" bordercolordark=\"#CCFFFF\">
  <tr background=\"http://www.mywebsite.com/images/Gradient.jpg\">
    <td height=\"40\">
      <div align=\"left\"><b> <font color=\"#009999\">Logged In</font></b></div>
    </td>
  </tr>
  <tr>
    <td height=\"62\">
      <p><font size=\"2\">Wellcome $_SESSION[username]!</font></p>
      <p><font size=\"2\">Thank you for logging in. You are being transfered...</font></p>
    </td>
  </tr>
  <tr background=\"http://www.mywebsite.com/images/Gradient.jpg\">
    <td height=\"40\">
      <div align=\"center\"><font color=\"#000000\"><a href=\"my_account.php\"><font size=\"2\">Click
        here if you do not wish to wait</font></a></font></div>
    </td>
  </tr>
</table>";
Please help me with this all it does is displays the table but no image background.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

Are the URLs valid? Try putting a div layer with your image as the background
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

Moved to Client Side...

You should try moving all your styling out into CSS. At the very least, try this

Code: Select all

<tr style = "background-image:url(http://mywebsite.com/images/Gradient.jpg">
...
Also, using heredocs rather than putting it in double-quotes will save you the trouble of having to escape a bunch of times.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
No0b
Forum Commoner
Posts: 37
Joined: Tue Feb 07, 2006 6:17 pm

Post by No0b »

i got it!

it's just you can't put the background in the <tr> tag. just the th and td tags.
User avatar
nickman013
Forum Regular
Posts: 764
Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York

Post by nickman013 »

well thanks to me i told him waht to do on AIM
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

Post by raghavan20 »

This is where you should be using heredocs instead of intializing strings in double quotes.

Code: Select all

$msg =<<<EOT
<table width=\"477\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\" bordercolorlight=\"#CCCCCC\" bordercolordark=\"#CCFFFF\">
  <tr background=\"http://www.mywebsite.com/images/Gradient.jpg\">
    <td height=\"40\">
      <div align=\"left\"><b> <font color=\"#009999\">Logged In</font></b></div>
    </td>
  </tr>
  <tr>
    <td height=\"62\">
      <p><font size=\"2\">Wellcome $_SESSION[username]!</font></p>
      <p><font size=\"2\">Thank you for logging in. You are being transfered...</font></p>
    </td>
  </tr>
  <tr background=\"http://www.mywebsite.com/images/Gradient.jpg\">
    <td height=\"40\">
      <div align=\"center\"><font color=\"#000000\"><a href=\"my_account.php\"><font size=\"2\">Click
        here if you do not wish to wait</font></a></font></div>
    </td>
  </tr>
</table>
EOT;
Post Reply