• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 358
  • Last Modified:

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

0
wantabe2
Asked:
wantabe2
1 Solution
 
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
 
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
Vimal DMCommented:
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
 
haloexpertsexchangeCommented:
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now