Results 1 to 9 of 9

Thread: <?php $php_self ?> - Firefox Vs. IE

  1. #1
    Registered
    Join Date
    Feb 2004
    Location
    Ontario, Canada
    Posts
    273

    <?php $php_self ?> - Firefox Vs. IE

    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?

  2. #2
    Registered Shockt's Avatar
    Join Date
    Oct 2005
    Posts
    67
    Try this instead:
    <? echo $_SERVER[PHP_SELF]; ?>

  3. #3
    Senior Member chromate's Avatar
    Join Date
    Aug 2003
    Location
    UK
    Posts
    2,348
    I use: <?=$PHP_SELF;?>

  4. #4
    Working. Masetek's Avatar
    Join Date
    Aug 2005
    Location
    Aust
    Posts
    543
    Or you could just have href="". Does the same job

  5. #5
    Administrator Chris's Avatar
    Join Date
    Feb 2003
    Location
    East Lansing, MI USA
    Posts
    7,055
    PHP, being server side, shouldn't be causing a browser issue. I'm guessing that its a javascript thing, not a php thing.
    Chris Beasley - My Guide to Building a Successful Website[size=1]
    Content Sites: ABCDFGHIJKLMNOP|Forums: ABCD EF|Ecommerce: Swords Knives

  6. #6
    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:
    <?=$php_self?>
    Roger Stringer - freekrai.net
    DBStract - Build Virtual Databases

  7. #7
    Senior Member chromate's Avatar
    Join Date
    Aug 2003
    Location
    UK
    Posts
    2,348
    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.

  8. #8
    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
    Roger Stringer - freekrai.net
    DBStract - Build Virtual Databases

  9. #9
    Senior Member chromate's Avatar
    Join Date
    Aug 2003
    Location
    UK
    Posts
    2,348
    ah right. didn't know that

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •