Current url

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ft310

    Current url

    This might be the dumb one for the day but, I need a PHP function (or
    whatever) similar to the JavaScript "self.locat ion" in PHP.

    Will someone please put me out of my misery.

    Thanks

  • axlq

    #2
    Re: Current url

    In article <1178140660.159 901.169340@e65g 2000hsc.googleg roups.com>,
    ft310 <tooheys@fullch annel.netwrote:
    >This might be the dumb one for the day but, I need a PHP function (or
    >whatever) similar to the JavaScript "self.locat ion" in PHP.
    Look at the header() function in the php documentation. A call like
    header("Locatio n: http://example.com/mypage.php?etc" ) will cause an
    instant redirect to that page.

    If you want the script to know the URL of the page that called it, use
    the predefined variable $_SERVER[] - see


    For example, $_SERVER['PHP_SELF'] in a script at the address
    http://example.com/mypage.php?etc would be /mypage.php/etc

    Hope that helps. -A

    Comment

    • ft310

      #3
      Re: Current url

      On May 2, 5:46 pm, a...@spamcop.ne t (axlq) wrote:
      In article <1178140660.159 901.169...@e65g 2000hsc.googleg roups.com>,
      >
      ft310 <tooh...@fullch annel.netwrote:
      This might be the dumb one for the day but, I need a PHP function (or
      whatever) similar to the JavaScript "self.locat ion" in PHP.
      >
      Look at the header() function in the php documentation. A call like
      header("Locatio n:http://example.com/mypage.php?etc" ) will cause an
      instant redirect to that page.
      >
      If you want the script to know the URL of the page that called it, use
      the predefined variable $_SERVER[] - seehttp://us.php.net/manual/en/reserved.variab les.php
      >
      For example, $_SERVER['PHP_SELF'] in a script at the addresshttp://example.com/mypage.php?etcw ould be /mypage.php/etc
      >
      Hope that helps. -A
      Thank you very much

      Comment

      • Tim Van Wassenhove

        #4
        Re: Current url

        ft310 schreef:
        On May 2, 5:46 pm, a...@spamcop.ne t (axlq) wrote:
        >In article <1178140660.159 901.169...@e65g 2000hsc.googleg roups.com>,
        >>
        >ft310 <tooh...@fullch annel.netwrote:
        >>This might be the dumb one for the day but, I need a PHP function (or
        >>whatever) similar to the JavaScript "self.locat ion" in PHP.
        >Look at the header() function in the php documentation. A call like
        >header("Locati on:http://example.com/mypage.php?etc" ) will cause an
        >instant redirect to that page.
        >>
        >If you want the script to know the URL of the page that called it, use
        >the predefined variable $_SERVER[] - seehttp://us.php.net/manual/en/reserved.variab les.php
        >>
        >For example, $_SERVER['PHP_SELF'] in a script at the addresshttp://example.com/mypage.php?etcw ould be /mypage.php/etc
        Be aware that $_SERVER['PHP_SELF'] can be tweaked (since it contains GET
        parameters), thus if you want to be safe you should not use it for
        generation of <form action='"'>...


        --
        Tim Van Wassenhove - Read my mind <url:http://www.timvw.be/>

        Comment

        Working...