php将form表单中的数据提交到mysql数据库后,文字变成?
<?php
header("Content-type:text/html;charset=utf-8");
$user=$_GET['name'];
$sex=$_GET["select1"];
$nation=$_GET['select5'];
$native=$_GET['select6'];
$num=$_GET['number'];
$pass=$_GET['pwd'];
$repass=$_GET['repwd'];
$ema=$_GET['em'];
$identy=$_GET['idnumber'];
$birdate=$_GET['sDate'];
$db_host="localhost";
$db_name="root";
$db_pwd="";
$link=mysqli_connect($db_host,$db_name,$db_pwd) ;//2.判断是否成功
if ($link){
echo"success";
}else {
echo"fail";}
//3.设置字符集
mysqli_set_charset($link,"utf8");
//4.选择数据库
mysqli_select_db($link,"test");
//$sql = "use lhy;";
$sql = "insert into info1(name,sex,nation,nationplace,num,password,repassword,email,id,bir) values ('$user','$sex','$nation','$native','$num','$pass','$repass','$ema','$identy','$birdate');";
if ($link->query($sql) === TRUE) {
echo"新记录插入成功";
} else {
echo " Error:".$sql."
".$link->error;
}
?>