DelphiFAQ Home Search:

Form data is always escaped with a backslash

 

comments1 comments. Current rating: 4 stars (1 votes). Leave comments and/ or rate it.

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.)


    Comments:

    2017-05-17, 10:17:43
    David from Taipei, Taiwan  
    rating
    What i don't understood is actually how you're not really a lot more smartly-favored than you may be right now.
    You are so intelligent. You know therefore significantly in terms of this matter,
    made me personally believe it from numerous numerous angles.
    Its like women and men are not interested unless it is one
    thing to do with Woman gaga! Your personal stuffs great. Always care for it up!

     

     

    NEW: Optional: Register   Login
    Email address (not necessary):

    Rate as
    Hide my email when showing my comment.
    Please notify me once a day about new comments on this topic.
    Please provide a valid email address if you select this option, or post under a registered account.
     

    Show city and country
    Show country only
    Hide my location
    You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
    Please type in the code:

    Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
    The owner of this web site reserves the right to delete such material.

    photo Add a picture: