PHP ?? ?? ?? ??? ?? ?? PHP ???
add.php ????? ??? ???? ?? ??????? ?????
?: ? ??????? ??, ??, ??? ?? PHP ??? ??? PHP ???? ????. ??? ? ??? ??? ?? ??? ???? action.php ?? ?????. ??, ?? ? ?? ??? ???? ?? ???? ?? ??? ?????
??????? ?? ?????
??(" content-type:text/html;charset=utf8");
$conn=mysqli_connect("localhost","root","root","study");
mysqli_set_charset($conn,"utf8") ;
$conn=mysqli_connect("localhost","root","root","study");
mysqli_set_charset($conn,"utf8") ;
?? ????? ???? ??? ?????
$name = $_POST['name'];
$sex = $_POST['sex'];
$age = $_POST['age'] ;
$ class = $_POST['class'];
$sex = $_POST['sex'];
$age = $_POST['age'] ;
$ class = $_POST['class'];
??????? ??? ??
$sql = "stu (`name`, sex, age, class) ?? ?? ??('$name', '$ sex','$age','$class')";
$rw = mysqli_query($conn,$sql);
$rw = mysqli_query($conn,$sql);
??? ?? ?? ??? ?????
<?php header("content-type:text/html;charset=utf8"); $conn=mysqli_connect("localhost","root","root","study"); mysqli_set_charset($conn,"utf8"); if($conn){ switch ($_GET['action']){ case 'add'://add $name = $_POST['name']; $sex = $_POST['sex']; $age = $_POST['age']; $class = $_POST['class']; $sql = "insert into stu (`name`, sex, age, class) values ('$name', '$sex','$age','$class')"; $rw = mysqli_query($conn,$sql); if ($rw > 0){ echo "<script>alert('添加成功');</script>"; }else{ echo "<script>alert('添加失敗');</script>"; } } } header('Location: index.php'); break; ?>
?? ??? ??? ???? ????. ??? ??? ?????