help with manipulating $_SERVER statement

Discussion in 'PHP' started by worldy, Jun 13, 2010.

  1. #1
    When I use the code

    
    <?php
    $path = $_SERVER['REQUEST_URI']; 
    echo $path;
    ?>
    
    PHP:
    I get an echo similar to "/example/index.php?a=test". I was wondering it it was possible only to echo out what follows the "=" sign? Any ideas?
     
    worldy, Jun 13, 2010 IP
  2. actress143

    actress143 Peon

    Messages:
    132
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    ya use preg_split, through this you can do that, but i dont know exactly.........!

    it's my idea..! but it is possible with that sure.
     
    actress143, Jun 13, 2010 IP
  3. Scripts man

    Scripts man Guest

    Messages:
    51
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    what do you mean?
    get the 'a' value?
     
    Scripts man, Jun 13, 2010 IP
  4. lukeg32

    lukeg32 Peon

    Messages:
    645
    Likes Received:
    19
    Best Answers:
    1
    Trophy Points:
    0
    #4
    You can access the full query string only (the bit after ?) by using $_SERVER['QUERY_STRING']

    If you know which variable you are trying to get the value of, you can access it, as per your example, as $_GET['a']
     
    lukeg32, Jun 13, 2010 IP