echo $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']

You can also use the following for PHP_SELF:

$_SERVER['REQUEST_URI'] <- has GET string as well
$_SERVER['SCRIPT_NAME'] <- haven't used this one yet

You could also use $_SERVER['SERVER_NAME'] instead of HTTP_HOST, but
HTTP_HOST is what the user typed in the URL.

-Dash

                Answers to Last Fortune's Questions:

(1) None.  (Moses didn't have an ark).
(2) Your mother, by the pigeonhole principle.
(3) I don't know.
(4) Who cares?
(5) 6 (or maybe 4, or else 3).  Mr. Alfred J. Duncan of Podunk,
    Montana, submitted an interesting solution to Problem 5.
(6) There is an interesting solution to this problem on page 1029 of my
    book, which you can pick up for $23.95 at finer bookstores and
    bathroom supply outlets (or 99 cents at the table in front of
    Papyrus Books).

On Fri, 6 Dec 2002, Radovan Radic wrote:

> Ok,
> what should i do ot get
> http://localhost/test
> I need this do make a link to homepage (i got same app on more servers and i
> dont want to hard-code in every page )
>
> Radovan
>
> "Erythros" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > because your asking for the document root, ie: the directory root.
> >
> > "Radovan Radic" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > Hi
> > >
> > > I installed Apache 1.3.27 on w2k, after using IIS.
> > > When i try to output
> > > print "<A HREF=\"$DOCUMENT_ROOT\">Home</A>;
> > > it gives me A HREF="c:/inetpub/wwwroot/test/"
> > > instead of
> > > http://localhost/test
> > > Why is that?
> > >
> > > Radovan
> > >
> > >
> >
> >
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to