<?php
header("Content-type:text/html;charset=utf-8");
$stuId=$_POST['stuId'];
$stuName=$_POST['stuName'];
$stuChinese=$_POST['stuChinese'];
$stuMath=$_POST['stuMath'];
$stuEnglish=$_POST['stuEnglish'];
echo $stuName;
$con=mysql_connect('localhost','root','');
echo $con ? '数据库连接成功' : '数据库连接失败';
/*
if(!$con){
echo '连接失败';
exit;
}else{
echo '连接成功';
}*/
mysql_select_db('db_student');
$sql = "INSERT INTO table_student VALUES($stuId,$stuName,'$stuChinese','$stuMath','$stuEnglish')";
//$sql = "INSERT INTO table_student(id,name,chinese,math,english)" . "VALUES($stuId,$stuName,$stuChinese,$stuMath,$stuEnglish)";
// $sql="insert into moneytb (riqi,item,inout,cost,bz) ". "values '$riqi','$item','$inout','$cost','$bz')";
$is_ok = mysql_query($sql);
if($is_ok == true){
echo '添加成功';
}else{
echo '添加失败';
}
echo $sql;
?>
<HTML>
<HEAD>
<TITLE>添加学生成绩界面</TITLE>
<meta charset="utf-8">
</HEAD>
<BODY>
<h1>添加学生界面</h1>
<script type="text/javascript"></script>
<form action="http://localhost/mysql/insertStudent.php" method="post">
学生编号<input type="text" name="stuId"><br>
学生姓名<input type="text" name="stuName"><br>
语文成绩<input type="text" name="stuChinese"><br>
数学成绩<input type="text" name="stuMath"><br>
英语成绩<input type="text" name="stuEnglish"><br>
<input type="submit" value="添加成绩">
</form>
</BODY>
</HTML>
慕莱坞森
森林海
潇潇雨雨