<? echo $PHP_SELF;?> extremely strange behavior on PC

Discussion in 'PHP' started by jacka, Jan 30, 2008.

  1. #1
    Hi

    I have a php code that searches and fetches records from Mysql database, and works fine on mac os x, however when i test it on pc, instead of fetching the data, the page loads my home page.

    Any ideas please, I am totally confused.

    Cheers guys.
     
    jacka, Jan 30, 2008 IP
  2. bigrollerdave

    bigrollerdave Well-Known Member

    Messages:
    2,112
    Likes Received:
    52
    Best Answers:
    0
    Trophy Points:
    140
    #2
    Does this happen to be your home page? If so make sure there isn't an index.php and an index.html on your server. Some browsers will default to the html and wont display the php version. That's my only guess because php isn't browser based. Php doesn't even see the browser it gets parsed on your server and then spits out html which is then displayed in the browser.
     
    bigrollerdave, Jan 30, 2008 IP
  3. Possibility

    Possibility Peon

    Messages:
    350
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Well, you can first try using the strictly correct PHP code - some computers will handle php shortcuts differently (like <? instead of <?php)

    
    <?php
       echo $_SERVER['PHP_SELF'];
    ?>
    PHP:
    However, what dave said is probably what is getting you.
     
    Possibility, Jan 30, 2008 IP
  4. jacka

    jacka Peon

    Messages:
    165
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Hi

    Thanks for both your help.

    I have taken both your advise on board but since I am newby, I don't know how to alter my index.php file.
    Possibility, you were right. Changed to proper syntax
    echo $_SERVER['PHP_SELF'];
    Code (markup):
    and worked just fine, although I know the index.php will come back to bite my backside some time in the future.

    cheers guys
     
    jacka, Jan 30, 2008 IP
  5. NetworkTown.Net

    NetworkTown.Net Well-Known Member

    Messages:
    2,022
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    165
    #5
    If you still run into problems you can check out this i found on google: http://www.weberdev.com/get_example-4291.html
     
    NetworkTown.Net, Jan 30, 2008 IP