Ross wrote:
<? $filename = basename($_SERVER['SCRIPT_FILENAME']); $link= "../text_only/$filename"; ?> any ideas how to prevent this error?
$_SERVER is an array. and also a variable. we can be sure it exists if we are running a webserver php module, so we don't need to test if it's set or not BUT the index of the array pointed to by 'SCRIPT_FILENAME' does not necessarily exist so (the contents of the $_SERVER is different from server to server)... $filename = basename(@$_SERVER['SCRIPT_FILENAME']); if (!$filename) { die('yuck!'); } or something like: if (!isset($_SERVER['SCRIPT_FILENAME'])) { die('yuck!'); } else { $filename = basename($_SERVER['SCRIPT_FILENAME']); } to see what's in $_SERVER do something like: ecoh '<pre>'; // this line assumes you are viewing the output via a webbrowser! print_r($_SERVER);
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php