I have a php file that will display the subjects (Im not gonna use dropdown anymore) of a professor along with two buttons that will display modals. The first button will display the class list of the subject via modal.
here is my code:
<main class="container-fluid">
<div class="row">
<section class="col-sm-2 scrollable" id="nav-sidebar">
<ul class="nav nav-sidebar">
<?php
include("../menu/navigation.php");
?>
</ul>
</section>
<section class="col-sm-10" id="content-wrapper">
</br></br>
<div class="container-wrapper">
<?php
$sql = mysql_query("select DISTINCT CONCAT(sb.subject_code,' ',sb.subject_description,' ',c.section,' ',c.schedules,' ',c.room) as 'subject' from classes c join subjects sb on sb.subject_code = c.subjects_code join student_classes s on c.id = s.classes_id join students st on s.students_id = st.student_id where c.employees_id = '$sessionvalue2'")
or die("No table selected " . mysql_error());
while($cl = mysql_fetch_array($sql))
{
echo "<p style='font-size:20px'>".$cl['subject']."   ",
'<button class="btn btn-primary" data-toggle="modal" data-target="#addLib"> See Class List </button>    ',
'<button class="btn btn-primary"> Check Attendance </button>',
"</p>","</br>";
}
?>
And here is my code for modal (same php file):
<!-- Modal -->
<div class="modal fade" id="addLib" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<div class="panel panel-info">
<div class="panel-heading">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 class="panel-title"></h3>
</div>
<br>
<div class="panel-body">
</div>
</div>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
<!-- Modal -->
Is it possible to use the same query I've used in modal? How can I do it? Thanks in advance.