Apostrophe in PHP > use addslashes?

Apostrophe in PHP > use addslashes?

If you have an input or textarea and the user writes some stuff in there that contains apostrophes, you won’t be able to process the data with $_GET or $_POST because the apostrophes.

What you can do is to add addslashes like this:

$string = addslashes($_GET[‘var’]);

or

$string = addslashes($_POST[‘var’]);

The var value will go trough, even if it contains apostrophes.

Add a comment: