Get the App
SLTechnology News&Howtos  ›  Development  › 

How to handle PHP form submission controls with a period (.) Will be converted to an underscore (_) problem

Shulou Source: shulou.com Published: 2022-06-03 05:33:56 10月03日 Update

Editor to share with you how to deal with PHP form submission controls with a period (.) Will be transformed into an underscore (_) problem, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's learn about it!

Recently, when I was working on a company project, I found a strange problem. When I submitted a normal form, I found that I could not get the submitted value normally. This discovery inevitably made me confused at the beginning. At first, I thought that there was something wrong with my service and could not write to the database normally. Later, I detected the SQL statement and found that the problem actually appeared in obtaining data. The data obtained turned out to be empty. Later, a debugging found that all the variables originally submitted to the backend were no longer expected variables and were transformed by PHP.

The test code is provided as follows:

Test form submission

Name:

Password:

QQ:

Address:

Telephone:

Gender: male and female

Commit

Code example 1

The results after running are as follows:

Figure 1

As you can see, all the things I have in the control. Number, are converted into _ underscore by the backend, in order to test some other symbols, so do the above test, so far, only the period (.) Will be converted to an underscore (_), so when I take it for granted that I use info.name to access the backend, I can't find it, because it has actually been converted to info_name.

The above is all the contents of this article entitled "how to deal with the problem that the PHP form submission control name contains a period (.) will be converted to an underscore (_)". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Questions underlines forms times tests controls data articles names code content variables take it for granted not much address company name most as above examples Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Docker Microsoft OPPO Reno Apple