Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Using $_GET

Posted on 2006-11-24
4
Medium Priority
?
285 Views
Last Modified: 2008-03-06
Experts,

I am currently using the $_GET method to extract a variable from a url.  The url looks as follows;

http://www.something.com/process.php?var=1

I can take out the variable 1, however I would like to implement the following to pull out a user id;

http://www.something.com/process.php?var=1&id=username

How can this be achieved?
0
Comment
Question by:nickmarshall
  • 2
  • 2
4 Comments
 
LVL 13

Expert Comment

by:rhickmott
ID: 18006802
$var = $_GET['var'];
$username = $_GET['userame'];


Or am I missing somethign here? You can specify as many GET varibles as you want and reference them by their index in $_GET
0
 
LVL 6

Accepted Solution

by:
aescnt earned 750 total points
ID: 18006886
Yes rhickmarshall, a minor oversight: it's $_GET['id'], 'username'.

Look at your URL:
   ?var=1&id=username
That reads: "var" is "1", and "id" is "username".

Maybe:
   $var = $_GET['var'];
   $username = $_GET['id'];
0
 
LVL 13

Expert Comment

by:rhickmott
ID: 18006905
Apologies for the spelling mistake ;)

I'm not the same person as the original poster :)

0
 
LVL 6

Expert Comment

by:aescnt
ID: 18007223
Oh hehe sorry. :)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
It’s a season to be thankful, and we’re thankful for users like you who engage on site, solve technology problems, and network with others in the industry. What tech are we most thankful for? Keep reading.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

963 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question