<meta http-equiv="Content-Type" Content-Type:text/html; charset=utf-8" />
<?php
//自动跳转
//header("Content-Type:text/html; charset=utf-8");
$type=$_GET['type'];
$ID=$_GET[id];
$url="show_user.php";
$id=$_POST["id"];
//$title= $_POST["title"];
$password = $_POST["password"];
//date_default_timezone_set("Asia/Shanghai");//php.ini里加入了date.timezone这个选项,默认情况下是关闭的,也就是显示的时间(无论用什么php命令)都是格林威治标准时间,和北京时间正好差8个小时。//$time = date("Y-m-d H:i:s");//获得当前时间
$con = mysql_connect("localhost","root","123");
if(!$con)
{
die('连接数据库失败!'.mysql_error());
}
//header("Content-Type:text/html; charset=utf-8");
mysql_select_db("test", $con);
mysql_query("set names 'utf8'",$con);
echo "中国";
switch ($type)
{
case edit:
$sql = "update test set id='$id',pass='$password' where id='$id'";
    $qu = mysql_query($sql,$con);
if($qu)
{
echo  "<script language='javascript'>alert('编辑成功!');window.location='show_user.php'</script>";
exit;
}
break;
case add:
if(!mysql_query("INSERT INTO test (id,pass) values ('$id','$password')"))
{
die('数据插入失败!'.mysql_error());
}
else
{
echo "<script language='javascript'> alert('留言成功');window.location.href='$url'</script>";
exit;
}
break;
case dele:
$sql ="delete from test where id ='$ID'";
    $qu=mysql_query($sql,$con);
if($qu)
{
            echo "<script language='javascript'> alert('删除成功!'); window.location.href='show_user.php'</script>";
exit;
}
break;
}
/*
// 插入数据库*/
?>
为什么$_GET['type']取不到值