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.
So in the future when you use the form, try not to use. Name.