Hi there. I have a page called htmlglobals.php that has a few functions in it, such as: error_message and success_message. This page is included on every page in the site.
These functions are used when an error occurs or when the page has been successfully completed.
I have never had a problem doing this before, but all of a sudden I am getting errors like
Fatal error: Cannot redeclare error_message() (previously declared in ...admin/includes/htmlglobals.php:3) in ...admin/includes/htmlglobals.php on line 3
It is like it is saying that I am reusing the function again somewhere, but I am not. It is only used once.
Here is the htmlglobals file
<?php
// Global File For HTML Layer
function error_message($msg)
{
?>
<td valign=top>
<br>
<p><b>Error: <? echo $msg; ?></b><br>
If this error persists please write us an email by <a href="mailto:asd@asd.com">clicking here</a>
</td>
<?
require("footer.php");
exit;
}
function user_error_message($msg) {
require("topnav.php");
require("sidenav.php");
?>
<td valign=top>
<br>
<table cellpadding=4 width=468 bgcolor="#000000">
<tbody>
<tr>
<td bgcolor=#1F509F><font color=#ffffff><b>Error!</b></font></td>
</tr>
<tr bgcolor=#cccccc>
<td valign=top><?php echo $msg; ?>
<br>
<a href="javascript:history.go(-1)"><< Back</a>
</td>
</tr>
</tbody>
</table>
</td>
<?
require("footer.php");
exit;
}
function success_message($msg,$forward, $forwardwhere) {
?>
<td valign="top">
<br>
<p><b>Success:</b> <?php echo $msg; ?>
<br>
<br>
Your are now being forwarded <a href="<?php echo $forward; ?>"><u><font color="#406766"><b><?php echo $forwardwhere; ?></b></font></u></a> If you are not transferred please click <a href="<?php echo $forward; ?>"><u><font color="#406766"><b>here</b></font></u></a>
<META HTTP-EQUIV="refresh" CONTENT="3; URL=<?php echo $forward; ?>">
</td>
<?php
require("footer.php");
}
?>
and here is how I use it in my pages
require ("../includes/htmlglobals.php");
That is the only time that page is included and it is the only time those functions are declared.
Any idea what is going on here? I am very confused about this.
Thanks!😃