![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Oct 2004
Posts: 10
Rep Power: 0
![]() |
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. |
|
|
|
|
|
#2 |
|
Programmer
|
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"] |
|
|
|
|
|
#3 |
|
Programming Guru
![]() |
php Syntax (Toggle Plain Text)
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. |
|
|
|
|
|
#4 |
|
Newbie
Join Date: Aug 2006
Posts: 11
Rep Power: 0
![]() |
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 ![]() |
|
|
|
|
|
#5 | |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
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:
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
|
#6 |
|
Programming Guru
![]() |
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.
|
|
|
|
|
|
#7 |
|
Programmer
Join Date: Feb 2006
Location: Columbus, OH
Posts: 84
Rep Power: 3
![]() |
Seems relevant to me...
|
|
|
|
|
|
#8 |
|
Programming Guru
![]() |
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. =\ |
|
|
|
|
|
#9 | |
|
Hobbyist Programmer
|
Quote:
sry just had too... ![]()
__________________
Pain is just weakness leaving the body.
|
|
|
|
|
|
|
#10 |
|
PFO Founder
![]() ![]() |
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
__________________
BIG K aka Kyle Programming Forums Kyle K Online Please do not PM or email me programming questions. Post them in the forums instead. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [Efficiency] Variables vs. Calculations | kurt | C | 7 | Dec 29th, 2005 2:39 PM |
| how to receive a value and pass it back ?? | dawn | C# | 1 | Oct 4th, 2005 10:12 AM |
| Pointers in C (Part II) | Stack Overflow | C | 2 | Apr 29th, 2005 10:39 AM |
| User ID and Pass | Dark Flare Knight | Java | 3 | Apr 21st, 2005 3:01 AM |
| Is it possible for me using session variables into a class? | see07 | C# | 1 | Mar 9th, 2005 5:32 PM |