标题: 请问下这段代码哪里有错。。
作者: 飞雨漫天 @Ta
时间: 2013-09-14
最近在写程序。。不知到这段代码哪里有错。。一直报错。。无语了,哪位大神指导下,谢谢了!下面的代码是从17行复制到38行的,请指教!
错误提示
Notice: Undefined index: in E:\WWW\install\index.php on line 17
Notice: Undefined index: act in E:\WWW\install\index.php on line 34
Notice: Undefined variable: my_conn in E:\WWW\install\index.php on line 38
<body>
<div class=\"body\">";
if($_GET['hd']=='mod'){
$dbname=$_POST['dbname'];
$hostname=$_POST['hostname'];
$username=$_POST['logname'];
$password=$_POST['dbpwd'];
$weizhi=$_POST['weizhi'];
if($conn = mysql_connect($hostname,$username,$password)){
if(mysql_select_db($dbname)){
$my_conn='ok';
echo"数据库连接成功";
}else{
echo"<b>数据库服务器连接成功,但数据库名称错误,请认真填写数据库名</b>
";
}
}else{
echo"<b>数据库服务器连接错误,请认真确认后在填</b>
";
}
}
if($_GET['act']=='del'){
unlink ("index.php");
exit;
}
if($my_conn != 'ok'){
$url_name=$_SERVER['REQUEST_URI'];
$url_name=explode("/",$url_name);
$url_num=count($url_name);
$url_num=$url_num-2;
echo "<form name=\"db\" action=\"index.php?hd=mod\" method=\"post\">
<p>程序安装位置</p>
[隐藏样式|查看源码]