iExchange Posted May 21, 2012 Share Posted May 21, 2012 Hello, I'm very happy to know about the urlencode and urldecode functions on p.105, but I got a little bit confused regarding the tip there. It says: "Values sent directly from a form are automatically URL-encoded prior to being sent and decoded upon arrival at the receiving script. Y ou only need the urlencode() function to manually encode data (as in the example)." So, why do I need to manually encode the data while values sent from a form are actually URLencoded automatically? Sorry for this dumb question but I have been thinking about this for half an hour, sorry... Though, this is the best book for beginning php learners like me. Link to comment Share on other sites More sharing options...
Edward Posted May 21, 2012 Share Posted May 21, 2012 PHP cannot encode the problematic values but will encode and decode non-problematic values automatically. And because a space in the middle of a url would cause it not to work. Link to comment Share on other sites More sharing options...
Larry Posted May 21, 2012 Share Posted May 21, 2012 Thanks for the nice words on the book. Basically, the browser automatically and smartly handles the encoding and decoding of form data. But data in the URL is not automatically handled by the browser, so you have to. Link to comment Share on other sites More sharing options...
Recommended Posts