Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jul 27th, 2006, 5:14 PM   #1
ZeeMan
Newbie
 
Join Date: Oct 2004
Posts: 10
Rep Power: 0 ZeeMan is on a distinguished road
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.
ZeeMan is offline   Reply With Quote
Old Jul 27th, 2006, 6:00 PM   #2
niteice
Programmer
 
niteice's Avatar
 
Join Date: Aug 2005
Posts: 98
Rep Power: 4 niteice is on a distinguished road
Send a message via AIM to niteice
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"]
niteice is offline   Reply With Quote
Old Jul 27th, 2006, 6:07 PM   #3
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 1,887
Rep Power: 5 Sane will become famous soon enough
Send a message via MSN to Sane
php Syntax (Toggle Plain Text)
  1. echo $_SERVER['REQUEST_URI'];

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.
Sane is offline   Reply With Quote
Old Aug 10th, 2006, 1:24 PM   #4
Xeoncross
Newbie
 
Xeoncross's Avatar
 
Join Date: Aug 2006
Posts: 11
Rep Power: 0 Xeoncross is on a distinguished road
Lightbulb 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
Xeoncross is offline   Reply With Quote
Old Aug 10th, 2006, 2:36 PM   #5
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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:
Now that wasn't to hard was it? ...was it???
That's a nasty one to catch. No spell checker is going to pick up on that 'to' and suggest 'too.' Most grammar checkers will conclude that something is wrong, but may suggest that it has something to do with misuse of infinitives. Dealing with this kind of typo is such a pain in the butt that I also recommend you get the economy-sized bottle of aspirin.
__________________
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
DaWei is offline   Reply With Quote
Old Aug 10th, 2006, 5:33 PM   #6
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 1,887
Rep Power: 5 Sane will become famous soon enough
Send a message via MSN to Sane
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.
Sane is offline   Reply With Quote
Old Aug 10th, 2006, 11:02 PM   #7
jaeusm
Programmer
 
jaeusm's Avatar
 
Join Date: Feb 2006
Location: Columbus, OH
Posts: 84
Rep Power: 3 jaeusm is on a distinguished road
Seems relevant to me...
jaeusm is offline   Reply With Quote
Old Aug 11th, 2006, 1:08 AM   #8
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 1,887
Rep Power: 5 Sane will become famous soon enough
Send a message via MSN to Sane
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. =\
Sane is offline   Reply With Quote
Old Aug 11th, 2006, 1:16 AM   #9
AntiNinja
Hobbyist Programmer
 
AntiNinja's Avatar
 
Join Date: Jun 2006
Location: The States
Posts: 101
Rep Power: 3 AntiNinja is on a distinguished road
Send a message via AIM to AntiNinja Send a message via Yahoo to AntiNinja
Quote:
I'm off
too see the wizard

sry just had too...
__________________
Pain is just weakness leaving the body.
AntiNinja is offline   Reply With Quote
Old Aug 11th, 2006, 1:42 AM   #10
big_k105
PFO Founder

 
big_k105's Avatar
 
Join Date: Mar 2004
Location: Fargo, ND
Posts: 1,650
Rep Power: 10 big_k105 is on a distinguished road
Send a message via AIM to big_k105 Send a message via MSN to big_k105 Send a message via Yahoo to big_k105
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.
big_k105 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:47 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC