<?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>教师 名称</th>
<th>上课时间</th>
<th>选 课</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"没有点击添加按钮!";
}
?>
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>教师 名称</th>
<th>上课时间</th>
<th>选 课</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"没有点击添加按钮!";
}
?>
解决方案 »
- php cookie如何跨域?
- PHP处理错误问题
- PHP+IIS+虚拟主机,如何保护特定目录不被访问,或者有条件的访问?
- 我选择一个头像,然后在文本框自动加上这个头像的名称 如何设计???
- 写留言版时 <? ............?> 不是用<?php?>么
- 怎么判断字符串的后3位是那种格式
- mysql的连接方式问题
- mysql无法打开。
- header("location:jxxxxx")和window.location在框架页下的使用问题,请帮忙
- 如何按年或年月组合来查询postgre数据库中的数据?
- php cgi模式下 运行php程序无法解析域名
- php cgi模式下运行 程序无法和服务器交互 报错无法解析域名
多了一个分号,难道不出错吗?