Using $_GET

Posted on 2006-11-24
Last Modified: 2008-03-06

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

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

How can this be achieved?
Question by:nickmarshall
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
LVL 13

Expert Comment

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

Accepted Solution

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

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

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

Expert Comment

ID: 18006905
Apologies for the spelling mistake ;)

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


Expert Comment

ID: 18007223
Oh hehe sorry. :)

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MSSQL - Lock Row from reading by other programs 9 61
Wordpress and Wufoo 1 39
while read ID; do 4 56
How do I Enable submit button only if listbox has items 4 33
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 …
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
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 count occurrences of each item in an array.

733 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