I have a web form that users can fill out and that content fills up a PDF with FPDF and PHP. When a user enters a word with an apostrophe, a slash appears before it on the P
I have used this as $str = preg_replace('/[^A-Za-z0-9_-]/','', $str); for me has been enough, I eliminate the not alphanumerical characters
$str = preg_replace('/[^A-Za-z0-9_-]/','', $str);