Background Image in PHP Page

Is there any way for me to add an image as the background in this .php code? The image name is going to be image25.jpg & will be located at c:\wamp\www\images

Thanks
<b> <p> <i> To go to the main page <a href="http://tned-g-psrflow/cflow/index.html">click here</a>.</p> </i>

<table>
      <thead>
      <tr>
	   <table border='5'>

<th>Employee Name</th>
<th>Assignments</th>

      </tr>      
      </thead>
      <tbody>
<?php
require('connection.php');

$query="SELECT employee, active, COUNT(employee) FROM psrinfo WHERE location = 'office1' AND active = '1' AND employee IN ('employee1','employee2') GROUP BY employee";
$result = mysql_query($query) or die(mysql_error());  
 
while($row = mysql_fetch_array( $result )) {
?>
       <tr>
           			
            <td><?php echo "".$row['employee']; ?></td>
            <td><?php echo "".$row['COUNT(employee)']; ?></td>

      </tr>
<?php } ?>            
      </tbody>
 
</table>

<br>

<table>
      <thead>
      <tr>
	   <table border='5'>


<th>Total Assigned to office1 employees</th>

      </tr>      
      </thead>
      <tbody>
<?php
require('connection.php');

$query="SELECT employee, active, COUNT(employee) FROM psrinfo WHERE location = 'office1' AND active = '1' AND employee IN ('employee1')";
$result = mysql_query($query) or die(mysql_error());  
 
while($row = mysql_fetch_array( $result )) {
?>
       <tr>
           			        
            <td><?php echo "".$row['COUNT(employee)']; ?></td>

      </tr>
<?php } ?>            
      </tbody>
 
</table>

<br>

<table>
      <thead>
      <tr>
	   <table border='5'>

<th>Total office1 Pending</th>

      </tr>      
      </thead>
      <tbody>
<?php
require('connection.php');

$query="SELECT employee, active, COUNT(employee) FROM psrinfo WHERE location = 'office1' AND active = '1' AND employee IN ('pending')";
$result = mysql_query($query) or die(mysql_error());  
 
while($row = mysql_fetch_array( $result )) {
?>
       <tr>
           			        
            <td><?php echo "".$row['COUNT(employee)']; ?></td>

      </tr>
<?php } ?>            
      </tbody>
 
</table>

<br>

<table>
      <thead>
      <tr>
	   <table border='5'>


<th>Total office1 Unassigned</th>

      </tr>      
      </thead>
      <tbody>
<?php
require('connection.php');

$query="SELECT employee, active, COUNT(employee) FROM psrinfo WHERE location = 'office1' AND active = '1' AND employee IN ('unassigned')";
$result = mysql_query($query) or die(mysql_error());  
 
while($row = mysql_fetch_array( $result )) {
?>
       <tr>
           			
         
            <td><?php echo "".$row['COUNT(employee)']; ?></td>

      </tr>
<?php } ?>            
      </tbody>
 
</table>

Open in new window

LVL 15
wantabe2Asked:
Who is Participating?
 
haloexpertsexchangeConnect With a Mentor Commented:
do you have a css fie any where?
if so put it in there.
Or if you have inline styles put it in like this <body style="background-image:url(smiley.gif); background-repeat:no-repeat; background-attachment:fixed; background-position:center;">
0
 
haloexpertsexchangeCommented:
try using css
body{
 background-image:url(filename);
}

Open in new window

and that will give you a background image.
0
 
ropennerCommented:
or javascript:

put this anywhere ... like after line 124

<SCRIPT language=javascript>
document.body.style.backgroundImage ="url(images/mybackground.png)";
</SCRIPT>
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

 
Loganathan NatarajanLAMP DeveloperCommented:
if you have body tag on the page, try like this,

look at the body tag, <body background="images/image25.jpg">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body background="images/image25.jpg">


<b> <p> <i> To go to the main page <a href="http://tned-g-psrflow/cflow/index.html">click here</a>.</p> </i>

<table>
      <thead>
      <tr>
	   <table border='5'>

<th>Employee Name</th>
<th>Assignments</th>

      </tr>      
      </thead>
      <tbody>
<?php
require('connection.php');

$query="SELECT employee, active, COUNT(employee) FROM psrinfo WHERE location = 'office1' AND active = '1' AND employee IN ('employee1','employee2') GROUP BY employee";
$result = mysql_query($query) or die(mysql_error());  
 
while($row = mysql_fetch_array( $result )) {
?>
       <tr>
           			
            <td><?php echo "".$row['employee']; ?></td>
            <td><?php echo "".$row['COUNT(employee)']; ?></td>

      </tr>
<?php } ?>            
      </tbody>
 
</table>

<br>

<table>
      <thead>
      <tr>
	   <table border='5'>


<th>Total Assigned to office1 employees</th>

      </tr>      
      </thead>
      <tbody>
<?php
require('connection.php');

$query="SELECT employee, active, COUNT(employee) FROM psrinfo WHERE location = 'office1' AND active = '1' AND employee IN ('employee1')";
$result = mysql_query($query) or die(mysql_error());  
 
while($row = mysql_fetch_array( $result )) {
?>
       <tr>
           			        
            <td><?php echo "".$row['COUNT(employee)']; ?></td>

      </tr>
<?php } ?>            
      </tbody>
 
</table>

<br>

<table>
      <thead>
      <tr>
	   <table border='5'>

<th>Total office1 Pending</th>

      </tr>      
      </thead>
      <tbody>
<?php
require('connection.php');

$query="SELECT employee, active, COUNT(employee) FROM psrinfo WHERE location = 'office1' AND active = '1' AND employee IN ('pending')";
$result = mysql_query($query) or die(mysql_error());  
 
while($row = mysql_fetch_array( $result )) {
?>
       <tr>
           			        
            <td><?php echo "".$row['COUNT(employee)']; ?></td>

      </tr>
<?php } ?>            
      </tbody>
 
</table>

<br>

<table>
      <thead>
      <tr>
	   <table border='5'>


<th>Total office1 Unassigned</th>

      </tr>      
      </thead>
      <tbody>
<?php
require('connection.php');

$query="SELECT employee, active, COUNT(employee) FROM psrinfo WHERE location = 'office1' AND active = '1' AND employee IN ('unassigned')";
$result = mysql_query($query) or die(mysql_error());  
 
while($row = mysql_fetch_array( $result )) {
?>
       <tr>
           			
         
            <td><?php echo "".$row['COUNT(employee)']; ?></td>

      </tr>
<?php } ?>            
      </tbody>
 
</table>
</body>
</html>

Open in new window

0
 
Vimal DMSenior Software EngineerCommented:
Hai,

You can even go by the following,using the CSS

1) background-image: url(test.jpg);
    background-repeat: repeat;

2) background-image: url(test.jpg);
    background-repeat: repeat-y;

3) background-image: url(test.jpg);
    background-repeat: repeat-x;

4) background-image: url(test.jpg);
    background-repeat: no-repeat;
0
 
Ray PaseurCommented:
PHP is a server-side programming language used to generate (almost always) HTML.  HTML is a client-side markup language.  So I would say that the PHP part of this is mostly irrelevant.  My preference would be to use the CSS as shown in ID:35709110.
0
 
wantabe2Author Commented:
I've tried a few of what you all have suggested & it works but the background inage is shown multiple times....is there any way to make the image be shown one time in the center of the screen?
0
 
haloexpertsexchangeCommented:
by doing something like this you can.
body
{
background-image:url('smiley.gif');
background-repeat:no-repeat;
background-attachment:fixed;
background-position:center;
}
0
 
wantabe2Author Commented:
I can't figure out where in the code that goes....
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.