![]() |
How to pass variables like a URL?
I would like to learn how to pass variables with URLs like:
http://mysite.com/directory/script.php/variable I've seen it done before in PHP, ASP and possibly Perl. I know that it is possible, I just don't know how to do it or what the proper name is. |
Maybe I'm misunderstanding what you're saying, but the web server rewrites it into something like:
http://mysite.com/directory/script.php?var1=variable You can then access it with the $_GET array. i.e. $_GET["var1"] |
:
That will output "/script.php/variable", which could easily be parsed in to what you need. Check the docs for what else $_SERVER holds, that could be of relevance. |
Understanding PHP's GET and POST
I wrote a lesson on understanding PHP's $_GET and $_POST functions. I really recommend that you read it if you want to use these functions. You can read it at:
http://www.learnphpfree.com/lesson-5...post-vt27.html oh, and let me know what you think :) |
Nice article. As a quibbler, I would suggest that (if you are going to disseminate something widely, and don't have an editor) you proofread many times.
Quote:
|
Xeoncross, to be frank, what does that have to do with the original poster's question? It's relevant to $_GET, $_POST, but not about them. This sounds like you're just grabbing an opportunity to advertise your website.
|
Seems relevant to me...
|
Well, I did say it was relevant. But it still has nothing to do with his question. $_POST and $_GET variables don't contain the raw data passed in http://mysite.com/directory/script.php/variable. See my first post for more information.
But enough of this, I'm off. =\ |
Quote:
sry just had too... :) |
I can't see any other way to do this other then the way that sane mentioned. Nothing about GET or POST will do this if you are trying to get your variable via file.php/var the onlyway I see to get variables from the url is to do $_GET['var'] or $_REQUEST['var'] from the url file.php?var=something
|
| All times are GMT -5. The time now is 12:23 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC