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 Quote Link to comment 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 ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.