PHP向MYSQL插入中文问题(插入英文正常,但是中文就失败)!!
==========================send.php=======================================
<?php
session_start();
require_once('connect.php');
mysql_select_db($db,$conn);
$times=date("Y-m-d H:i:s");
$title=$_POST['title'];
$content=$_POST['content'];
$author=$_SESSION['username'];
echo $content;
echo $title;
$sql="insert into articles (title,author,content,times) values ('$title','$author','$content','$times')";
$result=mysql_query($sql,$conn);
if ($result){
echo "<script>alert('发贴成功!');</script>";
}else{
echo "失败";
}
?>
========================write.php==========================================
<?php require_once('connect.php');?>
<?php
session_start();
if(isset($_SESSION['username'])){
$username=$_SESSION['username'];
mysql_select_db($db,$conn);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>发帖子</title>
</head>
<h1><div align="center">我要发贴</div></h1>
<body>
<center>
<form action="send.php" method="post" enctype="multipart/form-data">
<table width="500" border="0">
<tr>
<td>标题:</td>
<td><p>
<input name="title" type="text" size="40" />
</p>
</td>
</tr>
<br>
<tr>
<td>内容:</td>
<td><textarea name="content" cols="50" rows="10" style="overflow:scroll;overflow-x:hidden"></textarea></td>
</tr>
<tr>
<td>用户名:</td>
<td><?php echo $username;?></td>
</tr>
</table><br>
<input name="" type="submit" value="发贴"/>
<input name="" type="reset" />
<input name="" type="button" value="偶不发了" onClick="JavaScript:history.go(-1)"/>
</form>
</center>
</body>
</html>
请大家看看