Page 1 of 1

Making a picture background in my php script...

Posted: Wed Feb 08, 2006 3:53 pm
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.

Posted: Wed Feb 08, 2006 3:57 pm
by josh
Are the URLs valid? Try putting a div layer with your image as the background

Posted: Wed Feb 08, 2006 3:59 pm
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.

Posted: Wed Feb 08, 2006 4:21 pm
by No0b
i got it!

it's just you can't put the background in the <tr> tag. just the th and td tags.

Posted: Wed Feb 08, 2006 5:44 pm
by nickman013
well thanks to me i told him waht to do on AIM

Posted: Wed Feb 08, 2006 6:58 pm
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;