Re: Variables via url
| From: | Jim Giner | Date: | Sat, 12 May 2012 13:21:17 +0000 |
| Subject: | Re: Variables via url | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-317858@lists.php.net to get a copy of this message | ||
""Ashley M. Kirchner"" <ashley@pcraft.com> wrote in message
news:4FAD9D8B.4020001@pcraft.com...
>
> Can someone point me at examples or directions on how I can pass a
> variable via a URL in the following way:
>
> http://server.domain.com//script///variable/
>
> I will only be passing one single /variable/. And I want the
> /script/ to use that.
>
> I don't want to see what the script is, for example I don't want it
> to say 'script.php' or 'script.html' ...
>
> Is this possible through PHP only, or do I have to write a rewrite
> directive in Apache to accomplish this?
>
A URL has to point to a script - how will your server know what to do with
the incoming URL if it doesn't point to something? That said - format your
URL as a GET string and there's your variable.
Ex.:
http://server.domain.com/(scriptname)?variable&anothervariable&anothervariable
Or - if this url is coming from an already running script, you could post
the var to a session var and then send a url without the script name and let
your server's default document (index.php ?) receive it and look up the
session var, but that's a pretty silly way to handle things just to hide the
scriptname.
Of course, someone here with much more knowledge than I could very soon make
me look stupid :)