View Full Version : Noob question about form data

11-09-2005, 11:32 AM
When ever I use ' or " in a form text box and display it back on the page using php it appears with a \ in front of it. Is there anyway to avoid this extra character being added?

For example: "What's Up" entered into a text box would be displayed on the page as "What\'s Up

11-10-2005, 10:00 PM
Use htmlspecialchars(stripslashes($foo),ENT_QUOTES) when echoing form field input back onscreen. Use urlencode(stripslashes($foo)) when forming a link. Also check out this (http://www.php.net/manual/en/faq.html.php) page for more tips and examples related to PHP and HTML output.