Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index.PHP:
- <!doctype html>
- <html lang="en">
- <head>
- <section class="main-container">
- <div class="main-wrapper">
- <form class="calendar-form" action="button.inc.php" method="POST">
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <title>jQuery UI Datepicker - Default functionality</title>
- <link rel="stylesheet"
- href="//code.jquery.com/ui/1.12.1/themes/base/jquery-
- ui.css">
- <link rel="stylesheet" href="/resources/demos/style.css">
- <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
- <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js">
- </script>
- <script>
- $( function() {
- $( "#datepicker" ).datepicker();
- } );
- </script>
- </head>
- <body>
- <p>Date: <input type="text" id="datepicker"></p>
- <button type="submit" name="submit">Check Availability</button>
- </body>
- </html>
- Button.inc.Php:
- <?php
- if (isset($_POST['submit'])) {
- include_once 'dbh.inc.php';
- $date = mysqli_real_escape_string($conn, $_POST['date']);
- if (empty($date)) {
- header("Location: ../calendar/index.php?index=empty");
- exit();
- } else {
- $sql = "INSERT INTO system (date) VALUES ('$date');";
- $result = mysqli_query($conn, $sql);
- header("Location: ../calendar/index.php?index=success");
- exit();
- }
- } else {
- header("Location: ../calendar/index.php");
- exit();
- }
- ?>
- Dbh.inc.php:
- <?php
- $dbServername = "localhost";
- $dbUsername = "root";
- $dbPassword = "";
- $dbName = "calendar";
- $conn = mysqli_connect
- ($dbServername,$dbUsername,$dbPassword,$dbName);
Add Comment
Please, Sign In to add comment