I have two tables "setTearmlyExam.php" and "setTopics.php", what i want to do is this: in the "setTearmlyExam.php" i have a form with two select options, a radio button and a start button. each select option has an option from the database.
what am trying to do here is: when the start button is cliked, its will redirect to the "setTopics.php" and there display all the topics and question using the selected information on the "setTearmlyExam.php". I have two table where am selecting the data that will be displayed in the "setTopics.php"
"setTearmlyExam.php"
<form action="setTopics.php " method="POST" class="col s12" center>
<!-- setTopics.php -->
<div>
<label>Select Term</label>
<select name="terms" class="browser-default" required>
<option value="" disabled selected>Select Term</option>
<?php
// Selecting terms from database
$select_terms = $db->query("SELECT * FROM term");
if (!$select_terms) {
die('QUERY FAILED' .mysqli_error($db));
}
// Ends
// Using while loop tp fatch and loop term titles
while ($row = $select_terms->fetch_assoc()) {
$termId = $row['termId'];
$terms = $row['terms'];
echo "<option value='{$termId}'>{$terms}</option>";
}
?>
</select>
<label>Select Subject</label>
<select name="subjects" class="browser-default" required>
<option value="" disabled selected>Select Subject</option>
<?php
// Selecting subjects from database......
$Select_subjects = $db->query("SELECT *
FROM subjects
ORDER BY subj ASC");
if (!$Select_subjects) {
die("QUERY FAILED" . mysqli_error($db));
}
// Ends..
// Using while loop to fetch the subjects title
while ($rw = $Select_subjects->fetch_assoc()) {
$subjId = $rw['subjId'];
$subj = $rw['subj'];
echo "<option value='{$subjId}'>{$subj}</option>";
}
?>
</select>
</div>
<div class="ST">
<div class="col 6">
<label>
<input class="with-gap" name="Examtype" value="O" type="radio" required/>
<span>Objective</span>
</label>
</div>
<div class="col 12">
<label>
<input class="with-gap" name="Examtype" value="T" type="radio" />
<span>Theory</span>
</label>
</div>
</div>
</div>
</div>
<div class="card-action centerTxt">
<button class="btn waves-effect waves-light " type="submit" name="start">Start
<i class="material-icons right">send</i>
</button>
</div>
</div>
</form>
"setTopics.php"
<form action="">
<div class="card-content black-text">
<span class="card-title centerTxt">
<h4>Subject Title</h4>
</span>
<div>
<!-- Dropdown Trigger -->
<label for="">
<h6 class="" style="font-size: 15px; color:black;">CLICK ON EACH TOPIC TO SELECT QUESTIONS. <span style="color:red; font-size: 13px;">Don't Select more than 50 Questions.</span></h6>
<?php
$terms = 'terms';
$subjects = 'subjects';
// $Examtype = $_GET['Examtype'];
if ($Examtype = 'O') {
$topics = $db->query('SELECT * FROM topics WHERE ');
}
?>
<h5 class='dropdown-trigger ' style="color:#149fd5;" data-target='dropdown1'>Topics Here</h5>
</label>
<!-- Dropdown Structure -->
<ul id='dropdown1' class='dropdown-content'>
<p>
<label>
<input type="checkbox" value="" />
<span>Yellow</span>
</label>
</p>
</ul>
</div>
</div>
<div class="card-action centerTxt">
<button class="btn waves-effect waves-light " type="submit" name="start">Next
<i class="material-icons right">send</i>
</button>
</div>
</form>