Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

question about php code

Featured Replies

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

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 by Samus

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

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 by Wickham

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.