tags:

views:

44

answers:

2
$from = $_SERVER['REQUEST_URI'];

echo /marketing/clients.php?action=sendbook&issue=29

How to get clients.php?action=sendbook&issue=29 only? Thank you!

+3  A: 
$temp = explode("/",$from);
$temp = end($temp);

or even easier

basename($from);
Steve
Like the `basename()`. Good 1 up on me. haha
Jason
No hostility intended :) cheers mate
Steve
@Steve - I follow the "Special Olympics" rule (though I think it's distasteful). http://photos.commongate.com/11/38441_7dtr2scy8f_l.jpg No hostility intended.
Jason
+1  A: 
 echo $_SERVER['SCRIPT_NAME']."?".$_SERVER['QUERY_STRING'];
 // or (if you have to use $from)
 $from = $_SERVER['REQUEST_URI'];
 $url = parse_url($from);
 echo $url['path']."?".$url['query'];
 //or
 $url = explode("/",$from);
 echo $url[1];
Jason