0

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

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by Zagga
2

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.

0

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.