states from array

This commit is contained in:
Kar l5
2024-05-02 17:36:51 +05:30
parent f9c6511958
commit 036bec17ac

View File

@@ -100,12 +100,12 @@
$user_bvs = $user_stmt->fetchAll(PDO::FETCH_COLUMN); $user_bvs = $user_stmt->fetchAll(PDO::FETCH_COLUMN);
$user_bvs=explode(",", $user_bvs[0]); // you need to make the CSV to array. $user_bvs=explode(",", $user_bvs[0]); // you need to make the CSV to array.
foreach($rows as $row) { foreach($rows as $row) {
$isChecked = in_array($row['bv'], $user_bvs); $isChecked = in_array($row['bv'], $user_bvs);
?> ?>
<div class="flex flex-row"> <div class="flex flex-row">
<input type="checkbox" name="<?php echo $row['bv']; ?>" id="<?php echo $row['bv']; ?>" value="<?php echo $row['bv']; ?>" <?php if($isChecked) echo "checked"; ?> />&nbsp; <input type="checkbox" name="<?php echo $row['bv']; ?>" id="<?php echo $row['bv']; ?>" value="<?php echo $row['bv']; ?>" <?php if($isChecked) echo "checked"; ?> />&nbsp;
<label for="<?php echo $row['bv']; ?>" style="text-transform: uppercase;"><?php echo $row['bv']; ?></label> <label for="<?php echo $row['bv']; ?>" style="text-transform: uppercase;"><?php echo $row['bv']; ?></label>
</div> </div>
<?php <?php
} }
} else { } else {