Validating a Comments or Message textarea
I'm creating a straightforward contact form where I'm asking for:
Name [input]
Email [input]
Subject [input]
Message [textarea]
However, I'm having problems with the text I enter into the Message box
I'm noticing the following isssues:
a) apostrophes
If I enter an apostrophe I get a sql syntax error.
ex: That's the way it is.
This causes and error to occur in the SQL insert statement.
b) spaces are not conserved.
If I enter a message with 2-3 paragraphs of text. In the mysql database it seems to store as one long string of text and does not conserve the paragraph breaks
What am I missing? What functions am I overlooking that will sanitize the apostrophes and conserve paragraph breaks?
I realize the apostrophe bug can be quite serious as it leaves open possibility of a malicious SQL injection.
thanks in advance.
