Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to handle single/double quotes when inputing?

Status
Not open for further replies.

Tarianna

Programmer
Sep 4, 2010
16
US
I wrote a validation routine to handle invalid input but if the user types in a single or double quote in the first column of any text input in a html page, then the code appears in the input box:

<input id="itemNum" type="text" name="itemNum" value='>

I'm unsure how to handle this. I'm going to attempt to insert a '\' into the string so that it stops intercepting the HTML code (which reads as:

<input id="itemNum" type="text" name="itemNum" value=<TMPL_VAR name="itemNum">>

If anyone has an idea how to get around this weird error..I'm all ears.
-t
 
Change the "'s to &quote; and < to &lt; and that handles most of your issues.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top