FUNKAM35 Posted August 23, 2012 Share Posted August 23, 2012 Hi, how can I rewrite a url space to + eg rentals.php?province=Alsace Vosges Lorraine&country=France would be rentals.php?province=Alsace+Vosges+Lorraine&country=France thanks Quote Link to comment https://forums.phpfreaks.com/topic/267473-rewrite-url-space-to/ Share on other sites More sharing options...
trq Posted August 23, 2012 Share Posted August 23, 2012 url_encode. Quote Link to comment https://forums.phpfreaks.com/topic/267473-rewrite-url-space-to/#findComment-1371772 Share on other sites More sharing options...
FUNKAM35 Posted August 23, 2012 Author Share Posted August 23, 2012 Hi thorpe thanks where do I add this urlencode? Quote Link to comment https://forums.phpfreaks.com/topic/267473-rewrite-url-space-to/#findComment-1371798 Share on other sites More sharing options...
aliento Posted August 23, 2012 Share Posted August 23, 2012 when you recieve the data and when you send them Quote Link to comment https://forums.phpfreaks.com/topic/267473-rewrite-url-space-to/#findComment-1371819 Share on other sites More sharing options...
aliento Posted August 23, 2012 Share Posted August 23, 2012 or when you recieve the dataq str_replace(' ', '+', $request); Quote Link to comment https://forums.phpfreaks.com/topic/267473-rewrite-url-space-to/#findComment-1371821 Share on other sites More sharing options...
Christian F. Posted August 23, 2012 Share Posted August 23, 2012 urlencode () and rawurlencode () are both Output Escaping functions, which means you only use them right before outputting the content to the relevant system. In this case, just before sending the string in a header () call or adding it to a href or src attribute. (In the latter case, you'll want to use htmlspecialchars () as well. Note that you do not use output escaping functions when you retrieve content from the user, that's where Input Validation (which is a different beast) comes into play. PS: Note that you want to use the URL encode functions for the GET parameters only, and not the whole address. Quote Link to comment https://forums.phpfreaks.com/topic/267473-rewrite-url-space-to/#findComment-1371849 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.