In the middle of the night, I was bored with writing a PHP form test. After writing the code, I started the test and found that I couldn't submit it. After reading it for a long time, I didn't find the problem. Later I saw that I set the ID of a button to submit, for example: inputtypebuttonvalue: Submit idsubmit. The background tries to change the id to sub. The result is submitted successfully. This problem occurs for the first time. Note:
In the middle of the night, I was bored with writing a PHP form test. After writing the code, I started the test and found that I couldn't submit it. After reading it for a long time, I didn't find the problem. Later I saw that I set the ID of a button to submit, for example: input type = button value = submit id = submit. The background tries to change the id to sub. The result is submitted successfully. This problem occurs for the first time. Note:
In the middle of the night, I was bored with writing a PHP form test. After writing the code, I started the test and found that I couldn't submit it. After reading it for a long time, I didn't find the problem. Later I saw that I set the ID of a button to submit, for example:
,
The background tries to change the id to sub, and the result is submitted successfully. This problem occurs for the first time.
Note:After the original input button ID is set to submit, JS cannot control the form. submit () event.
After submission, go to the database to view the data and find that Chinese characters are garbled. To view the information, you need to set the encoding.
How to Set mysqli is::
$ Mysql = new mysqli ($ dbserver, $ dbusername, $ dbpassword, $ database );
$ Mysql-> query ("set names utf8 ");
Mysql also has a query function mysql_query ($ db, "set names utf8 ″);
Topics you may like
Original article address: the submission of the submit failed and the mysql saving in PHP encountered garbled code. Thank you for sharing it with the original author.