sciencebear Posted October 6, 2009 Share Posted October 6, 2009 In my website, I use the $_GET function on the user's profile pages. However, I recently encountered a problem. The page is set up like this: http://domain.com/profile.php?username=user $_GET['username']; This works fine for most usernames, but there is a problem with users who have spaces in their names. This function only gets everything before the first space. How can I use it to get the entire username? Link to comment https://forums.phpfreaks.com/topic/176676-solved-_get-function-question/ Share on other sites More sharing options...
kickstart Posted October 6, 2009 Share Posted October 6, 2009 Hi $_GET is not a function, it is just an array. There shouldn't be any spaces in the vars as they should be encoded:- http://www.w3schools.com/TAGS/ref_urlencode.asp All the best Keith Link to comment https://forums.phpfreaks.com/topic/176676-solved-_get-function-question/#findComment-931434 Share on other sites More sharing options...
cags Posted October 6, 2009 Share Posted October 6, 2009 The simplest way is to not use spaces in the url. If you are dymanically creating links use urlencode to convert spaces to a different character. Link to comment https://forums.phpfreaks.com/topic/176676-solved-_get-function-question/#findComment-931437 Share on other sites More sharing options...
sciencebear Posted October 6, 2009 Author Share Posted October 6, 2009 Thank you all for your help! Everything works fine now. Link to comment https://forums.phpfreaks.com/topic/176676-solved-_get-function-question/#findComment-931457 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.