欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

php get取不到值解决思路

程序员文章站 2022-06-01 11:35:29
...
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":
//加引号
php get取不到值解决思路

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。

相关文章

相关视频