floridaflatlander Posted December 21, 2011 Share Posted December 21, 2011 I've been using an option that's a state, an example would be South Carolina or North Dekota. In the url the $_GET var turns it into South+Carolina or North+Dekota. Is this common and okay across different Browsers? I've tried ie and firefox and the + sign is addded but I was wondering if they're just designed to be as idiot proof as possible. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/253605-is-it-okay-to-use-a-select-with-an-option-var-that-as-a-space/ Share on other sites More sharing options...
AyKay47 Posted December 21, 2011 Share Posted December 21, 2011 well, to my knowledge, most if not all modern browsers will automatically encode the data to be passed in the url. However if you want to be sure that it will, you can simply encode the data yourself. Quote Link to comment https://forums.phpfreaks.com/topic/253605-is-it-okay-to-use-a-select-with-an-option-var-that-as-a-space/#findComment-1300068 Share on other sites More sharing options...
floridaflatlander Posted December 21, 2011 Author Share Posted December 21, 2011 ... if you want to be sure that it will, you can simply encode the data yourself. Thanks Aykay.., I tried using str_replace last night change the space to a plus sign and it put something like South%2BCarolina (I think that's what it was more or less) in the url. I think i'll just put a dash instead of a plus sign in the spaces of the variables that need them then remove the dashes for the db query. I'll mark this closed in a couple of hours if no one else chimes in. Thanks again. S Quote Link to comment https://forums.phpfreaks.com/topic/253605-is-it-okay-to-use-a-select-with-an-option-var-that-as-a-space/#findComment-1300095 Share on other sites More sharing options...
AyKay47 Posted December 21, 2011 Share Posted December 21, 2011 ... if you want to be sure that it will, you can simply encode the data yourself. Thanks Aykay.., I tried using str_replace last night change the space to a plus sign and it put something like South%2BCarolina (I think that's what it was more or less) in the url. I think i'll just put a dash instead of a plus sign in the spaces of the variables that need them then remove the dashes for the db query. I'll mark this closed in a couple of hours if no one else chimes in. Thanks again. S it put a %2B in the url because that is the encoded value of +. as I said, you can either encode this yourself to be absolutely sure, or you can simply divide the words by a url-friendly character, which you have done. Quote Link to comment https://forums.phpfreaks.com/topic/253605-is-it-okay-to-use-a-select-with-an-option-var-that-as-a-space/#findComment-1300117 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.