How to solve the problem of automatically adding escape characters when passing parameters in PHP form POST

Source: Internet
Author: User
Tags php form
How to solve the problem of automatically adding escape characters when passing parameters in PHP form POST
This article introduces how to solve the problem of automatically escaping characters when passing parameters through form post in php. if you need it, refer to it.

Problem Description: input the mysql statement in the form and submit it to the PHP program. The PHP program performs the corresponding query and returns the result, during use, PHP automatically adds the escape character "\" to the front of the special characters (for example, ''" \ ") in the form "\", however, once it is added, you cannot use this statement for SQL queries.

Solution: in the form, enter:

Select * from device_information where manager_team regexp 'Huawei'

After printing, it becomes:

Select * from device_information where manager_team regexp \ 'Huawei \'

Check that the value of the magic_quotes_gpc option in the php. ini file is on. You can consider using the stripslashes function.

The above is the solution to the problem of automatically adding escape characters when passing parameters in PHP form POST. For more information, see PHP Chinese website (www.php1.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.