php get取不到值解決思路

來源:互聯網
上載者:User
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":
//加引號
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.