Originally posted by sstaubin01
I have had problems using $PHP_SELF with Netscape ...
It is erroneous to say that you have a problem with PHP and a browser (NS, IE, etc). PHP is executed on the server. Your browser (should) never see the php code in your scripts. All the browser receives is plain 'ol HTML. So if you are having issues with a browser then your PHP code is probably generating bad HTML.
There was a recent thread discussing a common mistake in using $PHP_SELF - not including it in the namespace within a function.
eg:
Code:
function foo() {
echo "<a href='$PHP_SELF?foo=bar'>foo bar</a>";
}
will generate the following HTML
Code:
<a href='?foo=bar'>foo bar</a>
Note how $PHP_SELF evaluated to "" creating the erroneous URL ?foo=bar
This is because the global $PHP_SELF was not in the scope of function foo(). NS and IE will handle this erroneous code differently. NS will do nothing when the hyperlink is clicked, while IE will interpret it as a self reference.
However,
Code:
function foo() {
global $PHP_SELF;
echo "<a href='$PHP_SELF?foo=bar'>foo bar</a>";
}
Will generate the following HTML
Code:
<a href='self.php?foo=bar'>foo bar</a>
So the issue is that for some reason the value of $PHP_SELF is not being set correctly.
Bookmarks