November 28, 201114 yr hi I wonder why this codes do not work <?php echo '<table background="Photo-0010.jpg"></table>' ?>/code] how should I use html code in php
November 28, 201114 yr hi I wonder why this codes do not work <?php echo '<table background="Photo-0010.jpg"></table>' ?> how should I use html code in php <?php echo '<table background="Photo-0010.jpg"></table>';?> Try that? Edited November 28, 201114 yr by Samus
November 29, 201114 yr hi I had try it but I can't see any image My mistake. I don't think you can use an image for a table background. I believe the background property is even deprecated or non-existant. If you want a portion of your website to have a background image, you'd need to use CSS to accomplish that. Have a read up here: http://www.w3schools.com/css/css_background.asp
November 29, 201114 yr Do you want to show a small table with a background or just print the words? As shown the echo will try to show a table but with no text, or would just repeat the words if you substituted the < and > with the character codes. Add the ; on the end and disable the " in the statement with a \ (although I may be wrong here because you have used ' to open and close the echo). <?php echo '<table background=\"Photo-0010.jpg\"></table>'; ?> If you want to show a small table try <?php echo '<table><tr><td style=\"background: url(\"Photo-0010.jpg\")\">Text in cell</td></tr></table>'; ?> Remember the ; at the end of the echo statement which I added to both above. You may need to use " instead of ' for the echo statement ( I never use ' ). Check the case of Photo-0010.jpg which isn't the same as photo-0010.jpg and try an absolute url for the image http://www.domain.com/Photo-0010.jpg although as Samus says, it may be impossible anyway. EDIT: You would do better to use php include instead of echo. I got this simple cod eto work. The main file is: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta name="keywords" content="Wickham"/> <meta name="description" content="Test items"/> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/> <title>Test</title> </head> <body> <?php include ("table-background.inc"); ?> </body> </html> and the separate include file called table-background.inc was <table style="background: url(orangew90x90.jpg); border: 5px solid black; width: 90px; height: 90px; border-spacing: 0;"> <tr> <td>Text in cell<br>Text<br>Text </td> </tr> </table> where you need a bit of text to see the background and you need sizes. Change the image filename to one of your's. Edited November 29, 201114 yr by Wickham
Create an account or sign in to comment