<?php
header("content-type:text/html;charset=gb2312");
$conn=mysqli_connect("locallos","root","root","study");
mysqli_set_charset($conn,"utf-8");
if($conn){
switch($_GET["action"]){
case 'add';
$name=$_POST['name '];
$sex=$_POST['sex'];
$age=$_POST['age'];
$class=$_POST['class'];
$sql=" hineinstecken stu(name,sex,age,class)values('$name','$sex','$age','$class')";
$rw=mysqli_query($conn,$sql);
if($rw>0){
echo "<script>alert('add success添加成功');</script>";
}else{
echo "<script>alert('add fail添加失败');</script>";
}
header('Location:index.php');
break;
}
}
?>
报什么错~
多注意一下链接配置时的条件是否写错了。比如密码,用户名等等,还有就是多查看一下代码的错误性