View Full Version : <?php $php_self ?> - Firefox Vs. IE

10-05-2005, 09:01 PM
For the guestbook link on http://www.theawesometeam.com/news.php I'm launching a new window with javascript. I have the href set as <?php $php_self ?>. In Firefox this works fine, but in IE it goes back to the index page. Any ideas how I can get around this?

10-06-2005, 12:06 AM
Try this instead:
<? echo $_SERVER[PHP_SELF]; ?>

10-06-2005, 02:55 AM
I use: <?=$PHP_SELF;?>

10-06-2005, 04:59 AM
Or you could just have href="". Does the same job

10-06-2005, 08:08 PM
PHP, being server side, shouldn't be causing a browser issue. I'm guessing that its a javascript thing, not a php thing.

10-07-2005, 11:00 AM
Actually, this is a very simple thing.
You are using:
<?php $php_self ?>
Which doesn't print anything at all.
The only reason it's working with firefox is more of a fluke of the browser than anything else.
As has been mentioned above, make the php_self echo out:

10-07-2005, 11:54 AM
That wont print anything either I don't think :) It needs to be in caps because it's an environment variable. $PHP_SELF not $php_self.

You're right about it being a browser fluke. Browsers handle blank URLs differently.

10-07-2005, 11:58 AM
That depends on the php settings actually.
$php_self and $PHP_SELF can both work if PHP has been told to ignore case sensitivity for variables.
I usually just use the <?=$_SERVER['PHP_SELF']?> anyway, but yeah, if you tell it to be case insensitive then it won't care if it's $php_self or $PHP_SELF

10-07-2005, 12:01 PM
ah right. didn't know that :)