PHP - Speach Marks in Form Problem

I have a form and somebody entered 8" by 15" into it and it stopped my function working.

How can I clean up the posted text before I send it to my function for processing?
Who is Participating?
Chris HarteConnect With a Mentor ThaumaturgeCommented:
Use the addslashes function.
If you are writing the content to a database use the mysqli_real_escape_string() instead to prevent injection attacks.
$str = "Is your name O'reilly?";
// Outputs: Is your name O\'reilly?
echo addslashes($str);

Open in new window

lwfukAuthor Commented:
Many thanks.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.