I get information from the database. That I list using a while loop. With this while loop, I list diseases with checkboxes. Unable to select checkboxes.
Code:
<li class="form-line" data-type="control_checkbox" id="id_5">
<label class="form-label form-label-top form-label-auto" id="label_5" for="input_5"> Do you have any of the followings? (select all that apply) </label>
<div id="cid_5" class="form-input-wide" data-layout="full">
<div class="form-single-column" role="group" aria-labelledby="label_5" data-component="checkbox">
<?php
// Create connection
$conn = mysqli_connect("localhost", "root", "", "covidtmsdb");
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql7 = "SELECT * FROM tblhealth_issues WHERE Category='disease'";
$result7 = mysqli_query($conn, $sql7);
if (mysqli_num_rows($result7) > 0) {
// output data of each row
while($row7 = mysqli_fetch_assoc($result7)) {
?>
<span class="form-checkbox-item" style="clear:left">
<span class="dragger-item">
</span>
<input type="checkbox" aria-describedby="label_5" class="form-checkbox" id="<?php echo $row7['Question'];?>" name="ques[]" value="<?php echo $row7['Symptoms'];?>" />
<label id="label_input_5_0" for="input_5_0"> <?php echo $row7['Symptoms'];?></label>
</span>
<?php
}
} else {
echo "0 results for Q7";
}
mysqli_close($conn);
?>
</div>
</div>
</li>
Aucun commentaire:
Enregistrer un commentaire