DelphiFAQ Home Search:
General :: Programming :: php
Find help with php (PHP: Hypertext Preprocessor), an open source, server-side, HTML embedded scripting language used to create dynamic Web pages.

Articles:

This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.

Featured Article

Form data is always escaped with a backslash

Question:

I am posting a form with text fields to a php script and it appears that when I read out the fields using
$_POST['fieldname'],
then all quotes (single and double) are preceded by a backslash.

How can I turn that off?

Answer:

The original (\ escaped) version is actually useful if you need to insert the data into a database. However, for display purposes or to write it to a text file, you'll better do without them.

You can either change the setting of magic_quotes, see detailed information here:

  • http://www.php.net/manual/en/configuration.php

    .. or, if you do not have access to that file (or do not want to change it), then you can call

    stripslashes($identifier)
    This function returns the unescaped string (slashes are removed, as the function's name suggests.)


  • Generated 0:01:55 on Nov 24, 2017