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? Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment 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. 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.