cparekh Posted April 22, 2008 Share Posted April 22, 2008 Hi, I'm trying to pass some data in a GET variable which, out of necessity, contains an '&' character- is there a way to escape it so php doesn't think it's a separator for another variable? Thanx in advance for your help. C. Link to comment https://forums.phpfreaks.com/topic/102294-escaping-in-a-get-variable/ Share on other sites More sharing options...
thebadbad Posted April 22, 2008 Share Posted April 22, 2008 urlencode(): This function is convenient when encoding a string to be used in a query part of a URL, as a convenient way to pass variables to the next page. Link to comment https://forums.phpfreaks.com/topic/102294-escaping-in-a-get-variable/#findComment-523769 Share on other sites More sharing options...
cparekh Posted April 22, 2008 Author Share Posted April 22, 2008 Thanks for that... The full value now comes through ok but because I need to use it in a query I guess I decode it using urldecode() so '%26amp%3B' is converted back to '&'? Thanks, C. Link to comment https://forums.phpfreaks.com/topic/102294-escaping-in-a-get-variable/#findComment-523787 Share on other sites More sharing options...
thebadbad Posted April 22, 2008 Share Posted April 22, 2008 Yep, that should do it. Link to comment https://forums.phpfreaks.com/topic/102294-escaping-in-a-get-variable/#findComment-523850 Share on other sites More sharing options...
DarkWater Posted April 22, 2008 Share Posted April 22, 2008 Thanks for that... The full value now comes through ok but because I need to use it in a query I guess I decode it using urldecode() so '%26amp%3B' is converted back to '&'? Thanks, C. Yes, use urldecode(). Link to comment https://forums.phpfreaks.com/topic/102294-escaping-in-a-get-variable/#findComment-523864 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.