Solved

Using $_GET

Posted on 2006-11-24
4
237 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
Comment Utility
$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 250 total points
Comment Utility
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
Comment Utility
Apologies for the spelling mistake ;)

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

0
 
LVL 6

Expert Comment

by:aescnt
Comment Utility
Oh hehe sorry. :)
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now