Page 1 of 1

Including PHP files

Posted: Thu Jul 07, 2011 12:17 am
by Vasudhevan
Dear Members

I am new to PHP. I design static pages using HTML. I am creating a PHP site. I have created two files as follows.

Header.PHP

<!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=utf-8" />
<title>Untitled Document</title>
<link href=../CSS/Headerstyles.css" rel="stylesheet" type="text/css" />
</head>

<body>

<table width="100%" border="1">
<tr>
<td class="headerbackground"><a href="#" class="headerlink">Home</a></td>
</tr>
</table>
</body>
</html>

Home PHP

<!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=utf-8" />
<title>Untitled Document</title>
</head>
<? php include ('Header.PHP');?>
<body>

<table width="100%" border="1">
<tr>
<td >&nbsp;</td>
</tr>
</table>
</body>
</html>

The above code done for including the Header.php file in the Home.php file is working in design time but not on runtime. Please suggest

Thanks in advance

Re: Including PHP files

Posted: Thu Jul 07, 2011 1:15 am
by social_experiment
Vasudhevan wrote:The above code done for including the Header.php file in the Home.php file is working in design time but not on runtime.
0.o What is the problem that you are having with the code? Remember that if you include a file, that whole file is included, meaning (in this case) you are getting multiple tags, double html headers which is maybe why you are having problems