aussiefly Posted February 26, 2008 Share Posted February 26, 2008 hi guys, i'm putting together a little referrer script for my site and I was just wondering if there is some simply way to 'grab' the variables listed in a URL. So for instance if a client was sending people to www.somerandomURL.com?refer=101 is there a way that when a new member then registers i can grab that account no out of the URL and store it in a variable for later use?? Link to comment https://forums.phpfreaks.com/topic/93098-variables-in-the-url/ Share on other sites More sharing options...
GingerRobot Posted February 26, 2008 Share Posted February 26, 2008 So you know the name of the variable in the URL? Just use the $_GET array: $refer = $_GET['refer']; Link to comment https://forums.phpfreaks.com/topic/93098-variables-in-the-url/#findComment-476954 Share on other sites More sharing options...
fnairb Posted February 26, 2008 Share Posted February 26, 2008 If you are trying to find out which variables are available you might try: $vars = array_keys($_GET); Though you may want to use $_REQUEST to include both GET and POST requests. You also have $_SERVER['QUERY_STRING'] which contains the, well, query string. Link to comment https://forums.phpfreaks.com/topic/93098-variables-in-the-url/#findComment-476958 Share on other sites More sharing options...
aussiefly Posted February 26, 2008 Author Share Posted February 26, 2008 awesome! That did the trick perfectly! Thanks for the help aussie Link to comment https://forums.phpfreaks.com/topic/93098-variables-in-the-url/#findComment-476960 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.