upperbid Posted July 26, 2009 Share Posted July 26, 2009 I am having a problem with a form in which I am using a hidden field on a review page for the title of an item: <p align="left"><input type="hidden" name="descp1" value="$descp1strip">$descp1strip</p> This field can have either ' or " in it. The problem is, that in the source code of the review page, the hidden value of the title below: 8" M Teleflora Gift lead crystal becomes one of the two below depending on how whether or not I quote " the value: "8" M Teleflora Gift lead crystal" 8" M Teleflora Gift lead crystal Neither one of these will work in the submission of the final review page, cutting it off to just the 8. If I replace the quotes " with ' instead, then I have the exact same problem if somebody uses the ' symbol in their title. Any suggestions. Robert Link to comment https://forums.phpfreaks.com/topic/167464-escape-characters-with-hidden-values-in-html-and-php/ Share on other sites More sharing options...
PFMaBiSmAd Posted July 26, 2009 Share Posted July 26, 2009 When you output data on a web page, you need to use htmlentities with the second parameter set to ENT_QUOTES so that HTML special characters present in the data are not operated on by the browser. When htmlentities are submitted to the server they are converted back to the literal characters. Link to comment https://forums.phpfreaks.com/topic/167464-escape-characters-with-hidden-values-in-html-and-php/#findComment-883028 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.