#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Olathe, KS, USA
    Posts
    11
    Rep Power
    0
    This is odd. I run MSIE 5 and have never had any problems with $PHP_SELF.

    If someone out there has both MSIE 5 and NS 4.5, would you take a look at this and tell me if you get the same results?

    I am running a server on Win2000 with MySQL and PHP 4.01p2 (as an .exe not ISAPI) installed.

    Go to http://www.kansascitysouth.com/index.php and copy the link, then paste it notepad or whatever and look at the url.

    In MSIE, it has the script name 'index.php' right before the querystring starts. In Netscape, however it omits the 'index.php' portion!!

    From this I would assume that PHP builds $PHP_SELF variable from the url passed from the browser to the script.

    Is there anyway to get this to ALWAYS show the full url, regardless of browser type? Perhaps using server variables?? I'm confused!

    Thanks,
    Todd
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Olathe, KS, USA
    Posts
    11
    Rep Power
    0
    Whoops... Nevermind.

    Here's a friendly reminder to declare your global variables within your functions!

    This includes $PHP_SELF too!

    global $PHP_SELF;

    will do the trick.

  4. #3
  5. No Profile Picture
    Gödelian monster
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jul 1999
    Location
    Central Florida, USA
    Posts
    2,307
    Rep Power
    62
    I looked at it with Netscape 4.7 and it showed the full URL. I don't see how NS4.5 could have a problem with $PHP_SELF, because that variable is generated by the server. However, once index.php becomes your only index for this directory. The query string will just automatically apply to index.php even if you just have http://www.kansascitysouth.com/?disp...le&article_db= {etc...}

    Right now it looks like you have index.html, index.shtml, and index.php in your root directory. Maybe this is causing some problem with the server. Have you tried index.php in a clean directory?

    ...and nevermind also. Glad you found it.

    [This message has been edited by rycamor (edited October 10, 2000).]
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Olathe, KS, USA
    Posts
    11
    Rep Power
    0
    Yeah the problem was that the function that generated the <A HREF> link wasn't getting the value of $PHP_SELF.

    Thanks for the reply..

    Just in case someone else has this problem, maybe this will save some time!


    Here's what was happening:

    Let's say that this script's location and name are 'http://www.mysite.com/index.php'

    $PHP_SELF was not getting assigned a value, so:
    echo "<A HREF="$PHP_SELF?name=Todd">";


    would literally produce this tag in HTML code: <A HREF="?name=Todd">

    instead of: <A HREF="/index.php?name=Todd">

    The interesting thing to note here is that IE and Netscape handle the missing script name differently.

    IE interprets the link as: http://www.mysite.com/index.php/?name=Todd in which case the link still functions properly.

    Netscape however, interprets the link as: http://www.mysite.com?name=Todd in which case the link defaults to whatever the server has setup as the default document(s).

    So if you are ever wondering why IE works with your links produced from a PHP script and not Netscape, check your source code!

    Thanks,

    Todd


    [This message has been edited by drpixel (edited October 10, 2000).]

Similar Threads

  1. Replies: 10
    Last Post: May 13th, 2004, 07:38 PM
  2. working with ODBC
    By jp1234 in forum Oracle Development
    Replies: 0
    Last Post: February 1st, 2004, 03:26 PM
  3. Add (no) of working days only to a date
    By newbie10 in forum PHP Development
    Replies: 4
    Last Post: January 15th, 2004, 05:45 AM
  4. LAN not working
    By dave2k in forum Computer Hardware
    Replies: 1
    Last Post: January 11th, 2004, 05:18 AM
  5. Replies: 8
    Last Post: December 18th, 2003, 09:29 AM

IMN logo majestic logo threadwatch logo seochat tools logo