我从sql中获取一个值,然后获取需要在链接点击中发送这些值的值,但是我有一个问题,第一个值没有获取链接点击ID。
我该如何解决?
<div>
<?php
$result2 = mysqli_query($con,
"SELECT *
FROM course
WHERE courseFaculty='$clickFaculty'
and courseYear='$clickYear'
and courseSemi=1
and courseStatus='Active'order by courseID asc ");
if ($result2 === false) {
die(mysqli_error());
}
while ($res2 = mysqli_fetch_array($result2)) {
?>
<table class="table" style="margin: unset; padding: unset">
<tbody>
<tr>
<td colspan="2">
<button type="submit" name="subject" value="<?php echo $res2['courseID']; ?>" class="btn btn-link "
style="margin: unset; padding: unset"><?php echo $res2['courseID']; ?>
- <?php echo $res2['courseName']; ?></button>
</td>
<th>
<a href="#CourseID<?php echo $res2['courseID']; ?>" class="float-right " title="Key"
data-toggle="modal"><span class="fa fa-key" "></span></a>
</th>
</tr>
</tbody>
</table>
<!-- delete course -->
<div id="CourseID<?php echo $res2['courseID']; ?>" class="modal fade" role="dialog" aria-hidden="true">
<div class="modal-dialog" role="document">
<form action="course.php?CourseID=<?php echo $res2['courseID']; ?>" method="post">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Enrolment key for <span
style="font-weight: bold"> "<?php echo $res2['courseName']; ?> "</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="form-group">
<input type="text" name="courseKey" class="form-control" placeholder="Enter here">
</div> <!-- form-group end.// -->
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancle</button>
<button type="submit" name="btnKey" class="btn btn-primary"> Submit</button>
</div>
</div>
</form>
</div>
</div>
<!-- end Modal -->
<?php
}
?>
<div>