rstewar Posted February 6, 2010 Share Posted February 6, 2010 I am trying to print data from a database into a form. I used the mysql_escape_string() function before the data was inserted so slashes were added before all quotes. The problem is that when I try to print the data and use stripslashes() to remove the slashes the output stops before the single quote ('). It is supposed to output "Billy Ray's.." The code that outputs the text: <input type='text' name='name' id='name' value='<?php echo stripslashes($fields['name']['value']); ?>' /> Image of output What I find odd is that the html source from the webpage shows the full string: <label>Name of Bar: <span class='required'>*</span></label> <input type='text' name='name' id='name' value='Billy Ray's...' /> Does anyone have any idea what is going on? Link to comment https://forums.phpfreaks.com/topic/191182-problem-printing-data-from-database/ Share on other sites More sharing options...
wildteen88 Posted February 6, 2010 Share Posted February 6, 2010 You should use htmlentities with the ENT_QUOTES flag rather than stripslashes. Link to comment https://forums.phpfreaks.com/topic/191182-problem-printing-data-from-database/#findComment-1008029 Share on other sites More sharing options...
rstewar Posted February 6, 2010 Author Share Posted February 6, 2010 Works great. Thanks for the help. Link to comment https://forums.phpfreaks.com/topic/191182-problem-printing-data-from-database/#findComment-1008035 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.