The data submitted by POST is wrong!_PHP tutorial

WBOY
Release: 2016-07-13 10:51:23
Original
844 people have browsed it




The data submitted by POST is wrong!

My system is win7. When I first configured the environment and tested it, there was a problem with characters. The characters were garbled. Then I messed around a lot. Now the characters in the field in mysql are "utf8_general_ci", and then I added "$result" in the php program. ->query("SET NAMES GB2312");"Only Chinese characters can be displayed normally, but now there is a problem. When registering the membership system, the registration information filled in regester.html is compared with the user name and password. When submitting the real name, department, etc. to register_process.php, something went wrong. The submitted information was messy and strange. Some of them I clearly filled in three Chinese characters, but the submission showed only one character, and some information could not be submitted at all. . . . Very strange. . . . What's going on?

Let me answer




D8888D reply content------------------------------------------------- ----------
utf8_general_ci ?
SET NAMES GB2312 ?
The coding you remember must be unified

D8888D reply content------------------------------------------------- ----------
[url=http://bbs.111cn.cn/redirect.php?goto=findpost&pid=1068945&ptid=128218]Link tag 2#[/url] tianshibao


Then please tell me how to change it

D8888D reply content------------------------------------------------- ----------
Database utf8_general_ci
mysql_query("set names utf8")

Also, when you write the code and save the file, remember to save it in utf8 encoding

D8888D reply content------------------------------------------------- ----------
utf8_general_ci ?
SET NAMES GB2312 ?
The coding you remember must be unified

D8888D reply content------------------------------------------------- ----------
First: Set the php file, mysql_query("set names utf8");
Second: Modify the html page:
If it still doesn’t work, you can use UltraEdit software, which can convert other encodings into utf8. Try

D8888D reply content------------------------------------------------- ----------
Add mysql_query("set names utf8")
to each file connecting to the database Then, the question mark became like this:
[img]http://www.hungfattrade.com/extfiles/11.jpg[/img]

....What to do

D8888D reply content------------------------------------------------- ----------
What format is your html file in?

D8888D reply content------------------------------------------------- ----------
Now two more questions.

1. The html file of registration information, the Chinese registration information submitted is always wrong,
2. I added mysql_query ("set names utf8") to the database connection program. Now the Chinese data read from the database has become garbled. It turns out that I wrote SET NAMES GB2312 and it can be displayed normally... the database The field encoding I set is utf8_general_ci


. . . . That’s weird, could it have something to do with win7

D8888D reply content------------------------------------------------- ----------
Database utf8_general_ci
mysql_query("set names utf8")


The original poster saved the database in UTF8 format and imported it again


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632567.htmlTechArticleThe data submitted by POST is wrong! My system is win7. After configuring the environment, characters appeared during the test. The problem is garbled characters. After a lot of messing around, the characters in the fields in mysql are now...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template