Hi There,
I wonder if there is anyone out there willing to give me advice. I have just started using PHP and am getting fatal errors on my very first and very simple project. I have created to files, "layout.php" and "index.php".
The code for layout.php is as follows:
<?php
function myheader($ptitle)
{
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body>
<table width="100%" border="2" cellpadding="0" cellspacing="0" bordercolor="#000000">
<tr>
<td colspan="3"> </td>
</tr>
<tr>
<td> </td>
<td>
<!-- End Header and Begin Content -->
<?php
} // close myheader()
function footer(){
?>
<!-- End Content and Begin Footer -->
</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</body>
</html>
<?php
} //close footer()
?>
And the code for index.php is the following:
<?php
// include the layout file
include $_SERVER['DOCUMENT_ROOT'].'/layout.php';
// myheader function from layout.php
myheader();
// Content
echo "Welcome to my Website!";
// footer function from layout.php
footer();
?>
The error I am getting reads as follows:
Fatal error: Call to undefined function: myheader() in .../test/index.php on line 6
Any useful advice or help from anyone would be very much appretiated.
Thanks!! (🙂)