www.webdeveloper.com
Results 1 to 5 of 5

Thread: How to get value from array $_GET ?

  1. #1
    Join Date
    Aug 2014
    Posts
    4

    How to get value from array $_GET ?

    Hi,
    PHP Code:
    print_r ($_GET); 
    output:
    Code:
    Array ( [subaction] => userinfo [user] => ShutteR19 )
    How to get value "ShutteR19" from this array?

  2. #2
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    2,366
    $_GET is an array like $_POST and this is a value from the Query string.

    So refering to the entity by its array name will return its value.

    eg..

    http:http://www.somedomain.com/products.p...&bay=149&box=3

    $_GET['item'] returns 14
    $_GET['bay'] returns 149
    $_GET['box'] returns 3
    Yes, I know I'm about as subtle as being hit by a bus..(\\.\ Aug08)
    Yep... I say it like I see it, even if it is like a baseball bat in the nutz... (\\.\ Aug08)
    I want to leave this world the same way I came into it, Screaming, Incontinent & No memory!
    I laughed that hard I burst my colostomy bag... (\\.\ May03)
    Life for some is like a car accident... Mine is like a motorway pile up...

    Problems with Vista? :: Getting Cryptic wid it. :: The 'C' word! :: Whois?

  3. #3
    Join Date
    Jul 2013
    Location
    Voorheesville NY USA
    Posts
    795
    echo $_GET['user'];
    JG
    PS - If you're posting here you should be using:

    error_reporting(E_ALL | E_NOTICE);
    ini_set('display_errors', '1');


    at the top of ALL php code while you develop it!

  4. #4
    Join Date
    Aug 2014
    Posts
    4
    Right.

    It works:
    PHP Code:
    echo $_GET['user']; 
    Thanks

  5. #5
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,392
    And if outputting to the browser, you might find this makes it a bit clearer, especially if you get into multi-dimensional arrays:
    PHP Code:
    echo "<pre>".print_r($_GETtrue)."</pre>"
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles