JezK
Edit File: request_quote.php
<?php include("app/checkSession.php"); include("app/adminObj.php"); if(!isset($_SESSION['user_id'])){ $customerObj->redirect('login.php'); } $dealsData=$customerObj->productDealList(); $dealsCheckboxes=''; if(isset($dealsData) && count($dealsData)>0) { foreach($dealsData as $v) { $activeClass=''; if($v['deal_id']==1) $selectAllClass="id='prdDeal'"; else $selectAllClass="class='prdd1'"; $dealsCheckboxes.="<div class='col-md-6'><label class='ml-4'>".trim($v['deal_name']). "<input type='checkbox' name='productwareHouseDeals[]' $selectAllClass value='".$v['deal_id']."' $activeClass><span class='checkbox'></span></label></div>"; } } include("header.php"); ?> <style> /* Hide the browser's default checkbox */ input[type="checkbox"] { position: absolute; opacity: 0; cursor: pointer; height: 0; width: 0; } .checkbox { position: absolute; top: 2px; left: 15px; height: 20px; width: 20px; background-color: #eee; /* border-radius:12px; */ } :hover input~.checkbox { background-color: #ccc; } /* When the checkbox is checked, add a blue background */ input[type="checkbox"]:checked~.checkbox { background-color: #17a2b8; } /* Create the checkmark/indicator (hidden when not checked) */ .checkbox:after { content: ""; position: absolute; display: none; } /* Show the checkmark when checked */ input[type="checkbox"]:checked~.checkbox:after { display: block; } /* Style the checkmark/indicator */ .checkbox:after { left: 7px; top: 3px; width: 6px; height: 10px; border: solid white; border-width: 0 3px 3px 0; -webkit-transform: rotate(45deg); -ms-transform: rotate(45deg); transform: rotate(45deg); } input[type="radio"] { position: absolute; opacity: 7; cursor: pointer; } span.checkmark { border-radius: 50%; height: 24px; width: 24px; position: relative; background-color: grey; color: #fff; display: inline-block; text-align: center; margin-right: 9px; } input:checked~.checkmark { background-color: #2196F3; } input:checked~.radio-inline { background-color: #2196F3; } </style> <div class="container mt-2"> <div class="row d-flex justify-content-center"> <div class="col-md-8 "> <form method="post" action="app/request_quote_app.php"> <input type="hidden" name="warehouse_id" value="<?php echo $_GET['id'];?>"> <div class="card"> <div class="card-header"> <h5 class="text-center">Request a Qoute</h5> <hr class="bg-info"> <div class="row"> <div class="col-md-6"> <div class="form-group"> <label for="sel1">Select list </label> <select class="form-control bg-light" id="select_type" name="select_list" style="border: none; border-left: 3px solid skyblue; border-radius: 0px;"> <option value="">select</option> <option value="1">space</option> <option value="2">pallet</option> </select> <div class="error select_error text-danger"></div> </div> </div> <div class="col-md-6"> <div class="form-group"> <label for="usr">Number of pallets 10-30</label> <input type="text" class="form-control bg-light" id="total_pallets" name="num_of_pallets" style="border: none; border-left: 3px solid skyblue; border-radius: 0px;"> <div class="error pallet_error text-danger"></div> </div> </div> </div> <div class="row"> <div class="col-md-6"> <div class="form-group"> <label for="usr">From*</label> <input type="date" class="form-control bg-light" id="from_date" name="from_date" style="border: none; border-left: 3px solid skyblue; border-radius: 0px;" onchange="cal()"> <div class="error from_error text-danger"></div> </div> </div> <div class="col-md-6"> <div class="form-group"> <label for="date">To* </label> <input type="date" class="form-control bg-light" id="to_date" name="to_date" style="border: none; border-left: 3px solid skyblue; border-radius: 0px;" onchange="cal()"> <div class="error to_error text-danger"></div> </div> </div> </div> <div class="row"> <div class="col-md-12"> <div class="form-group"> <label for="date">Days</label> <input type="text" class="form-control bg-light" id="total_days" name="total_days" style="border: none; border-left: 3px solid skyblue; border-radius: 0px;"> </div> </div> </div> <div class="row mt-3"> <?php echo $dealsCheckboxes;?> <span class="error deal_error"></span> <input type="hidden" name="dealsOrglength" id="dealsOrglength" value="<?php if(isset($dealsData) && count($dealsData)>0) echo count($dealsData); else 0; ?>" /> </div> <!-- ending of checkboxes --> <button class="btn btn-primary" type="submit" name="request_quote" onclick="return validateQoute();">submit</button> </div> </div> </form> </div> </div> </div> <?php include("footer.php"); ?> <script src="js/validations.js"></script> <script type="text/javascript" src="js/jquery-3.5.1.min.js"></script> <script type="text/javascript"> function GetDays() { var fromdate = new Date(document.getElementById("from_date").value); var todate = new Date(document.getElementById("to_date").value); // console.log(document.getElementById('pick_date').value); return parseInt((todate - fromdate) / (24 * 3600 * 1000)); } function cal() { if (document.getElementById("to_date").value != '') { // console.log("hello") document.getElementById("total_days").value = GetDays(); } } $(function() { $(document).on('click', '#prdDeal', function() { if ($("#prdDeal").prop('checked') == true) { $('.prdd1').prop('checked', true); } else { $('.prdd1').prop('checked', false); } }); }); </script>