Handling quotes with php forms
Posted on 2007-10-05
I'm working on a php form and having some trouble with handing quotes.
I realize it's probably not the best way to code it, but I've been wrapping the table elements of my form in print statements. This means that if I code:
print '<tr BGCOLOR="white"><td><INPUT TYPE="text" NAME="capFirst" SIZE=40></td>';
and the user enters: My name is "bob", the output will be "My name is" because the quotes are read as being an element of the code and essentially ignored.
I use addSlashes() when I'm handling the data to put it into my databases, etc but I'd like users to be able to enter both single and double quotes in their entry and have the program allow both (at least in the front end).
How do I do this? Any help is appreciated.