Home > Backend Development > PHP Tutorial > php get取不到值解决思路

php get取不到值解决思路

WBOY
Release: 2016-06-13 10:02:53
Original
1685 people have browsed it

php get取不到值

//自动跳转
//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 "";
exit;
}
break;
case add:
if(!mysql_query("INSERT INTO test (id,pass) values ('$id','$password')"))
{
die('数据插入失败!'.mysql_error());
}
else
{
echo "";
exit;
}
break;
case dele:
$sql ="delete from test where id ='$ID'";
$qu=mysql_query($sql,$con);
if($qu)
{
  echo "";
exit;
}
break;
}
/*
// 插入数据库



*/
?>


为什么$_GET['type']取不到值

------解决方案--------------------
switch ($type)
{
case "edit":
//加引号

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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template