PHP form submission Control name contains dot number (.) will be converted to an underscore (_) processing method _php Tips

Source: Internet
Author: User
Tags button type php form
When I was working on a company project recently, found a strange problem, submit a normal form, unexpectedly found that can not get the value of the submission, this discovery, unavoidably let me start confused, at the beginning of time I think that my service is problematic, not normal to write to the database, and then detect the SQL statement found, The original problem actually appeared in the acquisition of data, get to the data is empty, and later a debugging found that the original submitted to the back of all the variables, are already not expected variables, unexpectedly by PHP conversion.

The test code is provided as follows:
Copy Code code as follows:

<title> Test Forms Submission </title>
<body>
<form action= "" method= "POST" >
Name: <input type= "text" value= "test" name= "Info.name"/><br/>
Password: <input type= "text" value= "hahaha" name= "info.pwd"/><br/>
QQ: <input type= "text" value= "961412" name= "INFO.QQ"
Address: <input type= "text" value= "Zhejiang" name= "info|address"/><br/>
Tel: <input type= "text" value= "123456789" name= "1--phone"/><br/>
Sex: <input type= "Radio" name= "Info_gender" value= "1" checked> male <input type= "Radio" name= "Info_gender" value= "2 "> Women <br/>
<button type= "Submit" name= "Submit" value= "" > Commit</button>
</form>
</body>
<?php
if ($_post) {
Echo ' <pre/> ';
Var_export ($_post);
}
?>

Code Instance 1
After running the results are as follows:

Figure 1

As you can see, all the. Numbers I have in the control are converted to the back-end to underline, so as to test other symbols, so far, only the point number (.) has been found. will be converted to an underscore (_), so that when I take it for granted in the backend, I can't find it, because it has actually been transformed into a info_name info.name.

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.