Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

JavaScript datepicker disable dates that are in db

220061

Well-Known Coder
Hello,
Does anyone know how I can disable certain dates in my calendar based on the dates that are in the db??

so if the db has start_date (start_datum) 1-7-2022 and end_date (eind_datum) 3-7-2022. Then I want the code to disable all 3 of those days.
code:
JavaScript:
<?php include "config.php"; ?>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Datepicker - Display multiple months</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<?php
 $huis_ID = "1";

 $sql = "SELECT * FROM reserveringen WHERE huis_ID = ?";
 $stmt = $conn->prepare($sql);
 $stmt->bind_param("i", $huis_ID);
 $stmt->execute();
 $result = $stmt->get_result();
 while ($row = $result->fetch_assoc()) {
     echo $row['ID'];
     echo $row['start_datum'];
     echo $row['eind_datum'];
 ?>
<script>

$(function() {
    $( "#datepicker" ).datepicker({
    numberOfMonths: 1,
    minDate:0,
    showButtonPanel: true,
    altFormat: 'dd-MM-yyyy',
  
    });
});
</script>
</head>
<body>
<p>Date: <input type="text" id="datepicker" name ="datepicker"></p>

<?php } ?>
</body>
</html>

Picture of what it looks right now
1656694322402.png
 
Back
Top Bottom