0

my url is like below:

http://www.xyz.org/abc/list.php?id=1

now "$_SERVER['PHP_SELF']" gives me only "abc/list.php" this portion

and "$_SERVER['REQUEST_URI']" gives me "abc/list.php?id=1" this

now if i want to fetch only the portion "?id=1" how to do that. coz im having problems in the paging query for this.

thanxx in advance...

1
  • 1
    why don't you use $_GET['id'] ? Commented Oct 6, 2010 at 8:47

4 Answers 4

3

It's $_SERVER['QUERY_STRING'].

Sign up to request clarification or add additional context in comments.

Comments

0

Use $_GET['id'] to access the id parameter.

Comments

0

Take a look at http://php.net/parse_str, http://php.net/parse-url and http://php.net/http_build_query

Depending on what you're doing http://bradym.net/php/modify-query-string-parameters may also be helpful.

Comments

0

$_GET['id'] or $_REQUEST['id']

if your not sure which GET values u'll receive u also could

$fullRequest = exlode('?', $_SERVER['REQUEST_URI']);
$params = array();
foreach(explode('&', $fullRequest) as $part){
    foreach(explode('=', $part) as $keyVal){
        $params[$keyVal[0]] = $keyVal[1];
    }
 }

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.