Solutions to automatically add escape character problems when PHP forms post parameters

Source: Internet
Author: User
Tags form post php form
This article introduces the method of solving the problem of automatic escaping character when the form post in PHP is passed, and there is a need for a friend reference to learn.

Problem Description: The form input MySQL statement, and then submitted to the PHP program, the PHP program to do the corresponding query and return the results, when used to find that if you enter special characters in the form (such as "" \ "\ etc), PHP will automatically precede them with the escape character" \ ", but once it is added later, You can no longer use this statement for SQL queries.

Workaround: Type in the form:

SELECT * from device_information where Manager_team regexp ' Huawei '

After printing it, it becomes:

SELECT * from device_information where manager_team regexp \ ' huawei\ '

In the view php.ini file, the value of the MAGIC_QUOTES_GPC option should be on. You might consider using the Stripslashes function to resolve.

The above is the PHP form post parameters automatically add escape character problem resolution content, more relevant content please pay attention to topic.alibabacloud.com (www.php.cn)!


  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.