knuckle05
asked on
Form validation against SQL injection and HTML tags
Hi All,
I'm kind of new to javascript and was wondering if anyone had a function that could validate user input.
I'm not concerned about phone numbers and the like so much at this point, I just want to make sure that my field input does not contain HTML tags or script that could be used in an SQL Injection attack.
If I'm forgetting any other type of security issues that could be validated against, please advise.
Thanks alot.
I'm kind of new to javascript and was wondering if anyone had a function that could validate user input.
I'm not concerned about phone numbers and the like so much at this point, I just want to make sure that my field input does not contain HTML tags or script that could be used in an SQL Injection attack.
If I'm forgetting any other type of security issues that could be validated against, please advise.
Thanks alot.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you need it form some other reason then you could use something like this.
<html>
<head>
<script>
var strGlbWord ='hello \' \'\' '
function RepaceChar( strWord ) {
var strCharToRemove = '"';
regExp = new RegExp('['+ strCharToRemove +']','g');
return strWord.replace(regExp,'\'
}
</script>
</head>
<body>
<input type="button" onclick="alert( RepaceChar( strGlbWord ) );" value="Click Me" />
</body>
</html>
ant