Home > Database > Mysql Tutorial > submit提交失败和PHP中mysql保存出现乱码

submit提交失败和PHP中mysql保存出现乱码

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 16:33:16
Original
1074 people have browsed it

半夜无聊写PHP表单测试,写完代码开始测试,发现提交不上去,看了半天没发现问题在哪里,后来看到自己给一个button的ID设置为submit,例: input type=button value=提交 id=submit, 后台尝试着把id改为sub,结果提交成功了,第一次遇到这个问题。 小记一下:

半夜无聊写PHP表单测试,写完代码开始测试,发现提交不上去,看了半天没发现问题在哪里,后来看到自己给一个button的ID设置为submit,例:

,

后台尝试着把id改为sub,结果提交成功了,第一次遇到这个问题。
小记一下:原来input的button的ID设置为submit后,JS无法控制form.submit()事件。
提交以后进入数据库查看数据,发现中文是乱码的,查阅资料,需要设置编码。
mysqli的设置方法是
<br> $mysql=new mysqli($dbserver,$dbusername,$dbpassword,$database);<br> $mysql->query("SET NAMES utf8");<br>
mysql也有个query函数 mysql_query($db,”SET NAMES utf8″);

您可能喜欢的相关话题

Related labels:
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
Latest Issues
Why can’t my submit button submit data?
From 1970-01-01 08:00:00
0
0
0
Ajax click submit but no response!
From 1970-01-01 08:00:00
0
0
0
Click submit but nothing shows up
From 1970-01-01 08:00:00
0
0
0
git submit issue
From 1970-01-01 08:00:00
0
0
0
angular.js - angular's ng-submit does not trigger
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template