Mini Shell
<?php
require_once("../config.php");
cookiecheck();
?>
<?php
$course_id=$_POST['course_id'];
$year = $_POST['year'];
$i = 0;
$data=$conn->prepare("select DISTINCT chapter_id, subject_id from test_papers where year=$year and course_id=$course_id");
$data->execute();$result=$data->fetchall();
foreach ($result as $row) {
$subject_id = $row['subject_id'];
$data=$conn->prepare("select subject_name from subjects where subject_id=$subject_id");
$data->execute();$result1=$data->fetchall();
foreach ($result1 as $row1) {
if($i == 0){
echo "<div>".$row1['subject_name']."</div>";
}
$i++;
$chapter_id = $row['chapter_id'];
$data=$conn->prepare("select chapter_name from chapters where chapter_id=$chapter_id");
$data->execute();$result2=$data->fetchall();
foreach ($result2 as $row2) {
$cls = ($i % 2 == 0) ? 'left_side' : 'right_side';
echo "<div class='chapter_box ".$cls."'>";
echo "<div class='chapter_heading'>" .$row2['chapter_name']. "</div>";
$data=$conn->prepare("select * from test_papers where year=$year and chapter_id=$chapter_id");
$data->execute();$result3=$data->fetchall();
echo "<div class='question_box'>";
foreach ($result3 as $row3) {
// echo "<a href='test_question.php?que=".$row3['id']."'>".$row3['question']."</a>";
echo "<a href='#'>".$row3['question']."</a>";
echo "<br/>";
}
echo "</div></div>";
}
}
}
?>
<style type="text/css">
.chapter_box {
border: 1px solid #ccc;
width: calc(50% - 20px);
float: left;
margin-bottom: 10px;
margin-right: 20px;
}
.chapter_heading {
padding-left: 5px;
border-bottom: 1px solid #ccc;
font-weight: bold;
padding-top: 3px;
padding-bottom: 3px;
}
.question_box {
padding-top: 5px;
padding-left: 30px;
padding-bottom: 5px;
}
</style>
Zerion Mini Shell 1.0