lholland421 Posted March 20, 2014 Posted March 20, 2014 Hi All, Sorry to keep posting but i am at a brick wall with a few things and could do with some help i have a html contact form which users fill out.when they submit the form it gets sent as an email and also gets inputted into an SQL table. The problem i have is when ever people use special characters such as ' or " we get a syntax error. as soon as they remove this the form sends. How can i prevent this from happening? Any sort of validation that swaps the special characters for accepted ones? Thanks All
unixman_again Posted March 20, 2014 Posted March 20, 2014 If you've done your forrm with php, try filter_var to sanitise the user input. That's what I do.
lholland421 Posted March 20, 2014 Author Posted March 20, 2014 The form itself is html but processed to email and Sql with php. Would I be better recreating the form in php ?
LosOjos Posted March 20, 2014 Posted March 20, 2014 Sorry if this comes across as condescending, but I really think you ought to read up on SQL Injection attacks and how to prevent them; if you're not sanitising the input, a savvy student could destroy your SQL DB! PHP: SQL Injection - Manual
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now