freelance84 Posted October 4, 2010 Share Posted October 4, 2010 While testing... php seems to be changing the & symbol into a square bracket when retrieving from $_GET. I assume this is so it can still use the & to seperate variables placed into the URL. When i print_r the $_GET i get this: [name] => [lt;table] My question is... is there a function which decodes this? For example, the name, "<table>" is actually stored in my table due to html entities as you see therefore if the name is ever passed via the URL, the & messes it all up. Furthermore, are there any other characters like this i should be looking out for? Quote Link to comment https://forums.phpfreaks.com/topic/215135-php-reading-certain-_get-differently/ Share on other sites More sharing options...
Adam Posted October 4, 2010 Share Posted October 4, 2010 You need to encode the ampersand and semi-colon, as within URLs they are used to separate parameters. The PHP function urlencode will come in useful for you here. Quote Link to comment https://forums.phpfreaks.com/topic/215135-php-reading-certain-_get-differently/#findComment-1118922 Share on other sites More sharing options...
freelance84 Posted October 4, 2010 Author Share Posted October 4, 2010 ahh, brilliant. Thanks. I'm guessing the urldecode needs to be used on the other end when retrieving it again? Quote Link to comment https://forums.phpfreaks.com/topic/215135-php-reading-certain-_get-differently/#findComment-1118923 Share on other sites More sharing options...
Adam Posted October 4, 2010 Share Posted October 4, 2010 Depends on the situation. Normally, the browser will transform it to the right value for you though. Quote Link to comment https://forums.phpfreaks.com/topic/215135-php-reading-certain-_get-differently/#findComment-1118932 Share on other sites More sharing options...
Adam Posted October 4, 2010 Share Posted October 4, 2010 Sorry that's a bit misleading.. PHP automatically applies urldecode() to $_GET and $_REQUEST - the browser has nothing to do with it. Quote Link to comment https://forums.phpfreaks.com/topic/215135-php-reading-certain-_get-differently/#findComment-1118940 Share on other sites More sharing options...
freelance84 Posted October 4, 2010 Author Share Posted October 4, 2010 Cool, thanks a lot Quote Link to comment https://forums.phpfreaks.com/topic/215135-php-reading-certain-_get-differently/#findComment-1118946 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.