如何使用php

时间:2016-06-14 06:00:56

标签: php mysql ajax

我已经在Mysql数据库中为学生保存了多个课程id。

前:当然:1,5,7,9

如果我编辑学生,我该如何激活选定的课程..?

enter image description here

<?php
$courses_query=mysql_query("select * from `course` where status='1'");
while($c_fetch=mysql_fetch_array($courses_query)){
?>
<input type="checkbox" name="course[]" value="<?php echo $c_fetch['id']; ?>" id="courseid" <?php if($re['course']==$c_fetch['id']){ echo "checked='checked'"; } ?> /> <?php echo $c_fetch['course'];
?>
<?php
$cids=$c_fetch['id'];

$softw_qry=mysql_query("select * from `softwares` where course='$cids' and status='1'");
while($softw_fetch=mysql_fetch_array($softw_qry)){
?>

<input type="checkbox" name="software[]" value="<?php echo $softw_fetch['id']; ?>" <?php if($re['software']==$softw_fetch['id']){ echo "checked='checked'"; } ?> /> <?php echo $softw_fetch['software']; ?>

<?php
$soft_ids=$softw_fetch['id'];
$topicsn_qry=mysql_query("select * from `topics` where course='$cids' and software='$soft_ids' and status='1'");
while($topicn_fetch=mysql_fetch_array($topicsn_qry)){
?> 
<input type="checkbox" name="topics[]" value="<?php echo $topicn_fetch['id']; ?>" /> <?php echo $topicn_fetch['topic']; ?>
<?php } }} ?>

0 个答案:

没有答案