How to display URL of the site i'm on on the page

Discussion in 'PHP' started by netpox, Apr 30, 2008.

  1. #1
    I need to display in a textarea the url of the current page i'm on. How can i do that if my pages are in php? its a static page!
     
    netpox, Apr 30, 2008 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    If you can use .htaccess you can add .htm or .html to file types that will be parsed as php.

    Do this in .htaccess in the root folder of your site:
    AddType application/x-httpd-php .htm .html
    Code (markup):
    You can then use php on the static page just as if it were php.
     
    jestep, Apr 30, 2008 IP
  3. ToddMicheau

    ToddMicheau Active Member

    Messages:
    183
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    58
    #3
    I think what your looking for is this:

    
    <?
    echo "<textarea>Current page: http://yoursite.com" . $_SERVER['PHP_SELF'] . "</textarea>";
    ?>
    
    PHP:
     
    ToddMicheau, Apr 30, 2008 IP
  4. cyberceo

    cyberceo Banned

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    other shorter option :
    <textarea><?=$_SERVER['PHP_SELF']?></textarea>
     
    cyberceo, Apr 30, 2008 IP