I am trying to do one new thing i.e. when i check one checkbox another checkbox will be checked automatically. I have two checkbox in each row i.e. it is in loop.
Here is my full code :
<?php
include("config.php");
$sql="SELECT * FROM inventory_details where status ='0' AND role='0' ORDER BY position ASC, role ASC, visiter DESC limit 0,100";
$query=mysqli_query($conn, $sql);
?>
<form method="post" action="" id="msform">
<div class="container">
<div class="row invent_det cate_head">
<div class="col-md-1 "><strong>Select </strong></div>
<div class="col-md-1 "><strong>Select </strong></div>
</div>
<?php
$i=0;
$today_date=date("Y-m-d H:i:s", time());
while($row=mysqli_fetch_assoc($query)){
$id = $row['id'];
$catagory_name = $row['catagory_name'];
$PrimaryMobile_no = $row['PrimaryMobile_no'];
?>
<div class="row" style="background-color: <?php echo $inventorybackground; ?> !important; color: <?php echo $inventorycolor; ?>; padding-top: 10px;">
<div class="col-md-1 inventory-data">
<input type="checkbox" id="checkItem" name="firm_name[]" value="<?php echo $firm_name;?>-<?php echo $PrimaryMobile_no;?>">
</div>
<div class="col-md-1 inventory-data">
<input type="checkbox" id="checkItem" name="check[]" value="<?php echo $row["id"]; ?>">
</div>
</div>
<?php
$i++;
}
?>
</div>
</form>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js'></script>
<script src="js/script.js"></script>
I have already tried some examples but failed to do so. I have implemented these https://jsfiddle.net/Bhawesh7731/4jsbLedn/
https://jsfiddle.net/Bhawesh7731/0ryts35u/
but when i check one checkbox, all the checkbox are checked automatically and i don't want that. I only want that, when i check the checkbox another checkbox of that row will be checked.
Aucun commentaire:
Enregistrer un commentaire