0
Я хочу получить дату и сделать SQL-запрос с ним, но у меня есть небольшая проблема: S Я не могу получить дату, и я не знаю, как передать переменную php: S Даже больше, я не разрешается использовать представить (Post и Get методы)Bootstrap datepicker getDate и SQL
<?php
session_start();
if(isset($_SESSION['myusername']))
{
$hi='';
}else
{
header("location:login.php");
}
require_once '../../templates/DBconnect.php';
$link = DBconnect::connect();
?>
<html>
<head>
<title>bootstrap datepicker examples</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- Bootstrap CSS and bootstrap datepicker CSS used for styling the demo pages-->
<link rel="stylesheet" href="../css/datepicker.css">
<link rel="stylesheet" href="../css/bootstrap.css">
</head>
<body>
<div class="container" width="50%">
<div class="hero-unit" width="50%">
<input type="text" placeholder="Begin Date" id="example1">
</div>
</div>
<div class="container" width="50%">
<div class="hero-unit" width="50%">
<input type="text" placeholder="End Date" id="example2" onchange="hole()">
</div>
</div>
<!-- Load jQuery and bootstrap datepicker scripts -->
<script src="../js/jquery-1.9.1.min.js"></script>
<script src="../js/bootstrap-datepicker.js"></script>
<script type="text/javascript">
// When the document is ready
$(document).ready(function() {
$('#example1').datepicker({
format: "dd-mm-yyyy"
});
});
$(document).ready(function() {
$('#example2').datepicker({
format: "dd-mm-yyyy"
});
});
function hole(){
this.$('.example1').datepicker('getDate');
alert($('#example1').val());
}
</script>
</body>
</html>
Используйте AJAX, тогда он позволяет выполнять PHP без обновления вашей страницы. Вам в основном нужно создать отдельный файл PHP и отправить значение даты в этот файл через AJAX. –