raku Posted June 4, 2008 Share Posted June 4, 2008 Hi, As I described in a previous thread, users coming to one of my forms can have fields automatically filled out if their URL has the right variables in it. For example: http://example.com/form.php?text=awesometest will fill out the text field with: awesometext Sometimes though those URL variables are encoded, and if the text contains a quote ("), it is encoded to " so the URL looks like http://example.com/form.php?text=%26quot%3Bawesometext%26quot%3B This displays in the input text field as "awesometext" and in the page source as "awesometext" It only displayed correctly after I applied html_entity_decode on top of urldecode on the variable from the URL. I then apply htmlentities before outputting it. Once the user submits this form, another script adds the text in to the database. The field in the database shows exactly: "awesometext" I was expecting it to show: "awesometext" Although it is doing what I wanted, I was expecting to have to apply html_entity_decode again in the script that adds the text to the database. Is something decoding it along the way automatically? Should I apply html_entity_decode just to be safe? Thanks so much! Link to comment https://forums.phpfreaks.com/topic/108667-encoding-and-decoding-question/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.