?
Solved

Using $_GET

Posted on 2006-11-24
4
Medium Priority
?
281 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

7 Extremely Useful Linux Commands for Beginners

Just getting started with Linux? Here's a quick start guide that has 7 commands that we believe will come in handy.

Question has a verified solution.

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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

752 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