<?php
error_reporting();
header("content-type:text/html;chartset:utf-8");
include_once'link.php';
?>
<style type="text/css">
body{background:antiquewhite; color:darksalmon;font-family: "arial black";}
</style>
<form name="addform" action="add.php" method="post">
<table border="1" align="center">
<caption style="font-size: 24px;">课程管理河池学院公共选修课信息</caption>
<tr>
<th>课程编号</th>
<th>课程名称</th>
<th>上课地点</th>
<th>教师&nbsp;名称</th>
<th>上课时间</th>
<th>选&nbsp;&nbsp;课</th>
</tr><?php $sql="select * from kechengbiao";
$rs=mysqli_query($link,$sql);
while($row=mysqli_fetch_array($rs)){
echo "<tr>
<td>{$row['zkc_id']}</td>
<td>{$row['zkc_name']}</td>
<td>{$row['zkc_classroom']}</td>
<td>{$row['zkc_teacher']}</td>
<td>{$row['zkc_time']}</td>
<td>";

?>

<input type="checkbox" name="xk[]" value="queren" />
<?php
echo"
</td>
</tr>";


}
?> 
<tr align="center">
<td colspan="6" align="center">
<input type="submit" name="xk" value="添加选课">
<input type="reset" name="cancle" value="取消" />
</td>
</tr>
</table>
</form><?php

error_reporting();
header("content-type:text/html;chartset:utf-8");
include_once'link.php';
$id=$_GET['id'];
$sql="select * from kechengbiao where id='$id'";
$rs=mysqli_query($link,$sql);


// $sql="select * from kechengbiao";
// $rs=mysqli_query($link,$sql);
// while($row=mysqli_fetch_array($rs)){
//
// $id=$row['zkc_id'];
// $name=$row['zkc_name'];
// $p=$row['zkc_classroom'];
// $tea=$row['zkc_teacher'];
// $t=$row['zkc_time'];
//}
if(isset($_POST['xk'])){

$kcname=$_POST['name'];
$place=$_POST['p'];
$teacher=$_POST['tea'];
$time=$_POST['t'];

if(!empty($kc_id)){
$sql="insert into xuankebiao(,kc_name,kc_classroom,kc_time,kc_teacher) values ('$kcname','$place','$jiaoshi','$time')";
//insert into title(title, type) values ('$subject', '$type')";
$result=mysqli_query($link,$sql);
//$result=mysqli_query($link,"insert into xuankebiao(kc_id,kc_name,kc_classroom,kc_time,kc_teacher) values ('$kcid','$kcname','$place','$jiaoshi','$time");
//向数据库中添加写的数据
  if($result){
?>
<script type="text/javascript"> 
     window.location.href="addcourse.php"; 
   </script> 
<?php
  
  //header() 函数向客户端发送原始的 HTTP 报头。header("location:addcourse.php");
}
else {
echo"执行SQl 错误:".mysql_error();
}
mysqli_close($link);

}else{
echo"获取数据不成功!";
}
}
else{
echo"没有点击添加按钮!";
}
?>