Member Avatar for Zagga

Hi folks,

I'm having a real "Dime Bar" moment! :-/
I have written a small function to display error messages. I can't work out why I have to use a preceeding slash to include my footer.php but not my header.php when they are both in the same directory.

function show_error($my_error)
{
include($script_url . "header.php");
echo "<h2>$my_error</h2>";
echo "<form method='post' action='whatever.php'>";
echo "<p><input type='button' name='back' value='BACK' onclick='history.go(-1)' />";
echo "</form>";
include($script_url . "/footer.php");
exit();
}

I just know it's going to be so simple I will slap myself :-O

Thanks
Zagga

Where is script_url defined? Global variables = bad. And do some debugging. replace include with echo to see what the actual value being passed to include is.

Member Avatar for Zagga

Thanks ShawnCplus,
script_url wasn't defined despite a call to a config file (I know it's bad to use globals, trying to break that habbit before its set in stone).

Thanks again,
(a very embarrased) Zagga

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.