mkosmosports Posted February 17, 2008 Share Posted February 17, 2008 Hello, I have a 'page' parameter in the URL. I dont know whether it will be preceeded by a ? or a &, but I want to take it out and put the result into a variable. Right now Im accomplishing that using simple regex and if/else statements. Im wondering if there is a ready-made php function which would know how to manipulate URL's like that. Thanks. mkosmosports Link to comment https://forums.phpfreaks.com/topic/91550-take-out-param-from-url/ Share on other sites More sharing options...
Stooney Posted February 17, 2008 Share Posted February 17, 2008 If you mean something like http://mysite.com/index.php?page=1 then just use $_GET <?php //Assume the url is http://mysite.com/index.php?page=1&name=jim $page=$_GET['page']; $name=$_GET['name']; echo $name.' is on page '.$page; //This will output Jim is on page 1 ?> Link to comment https://forums.phpfreaks.com/topic/91550-take-out-param-from-url/#findComment-468947 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.