I have a form and the datepicker (id data) field is not working.
Does anyone have an idea why?
Below code:
<?php
include("connections/configuration.php");
if(isset($_POST['nome'])){
$nome=utf8_decode($_POST['nome']);
$mensagem=utf8_decode($_POST['mensagem']);
$data=utf8_decode($_POST['data']);
if($nome=="" OR $mensagem=="" OR $data==""){
echo "<script>location.href='index.php';</script>";
}
//cadastra no db a indicacao
$QueryCadastro="Insert Into viplist(nome,mensagem,data)VALUES('$nome','$mensagem','$data')";
$ExecutaQueryCadastro=mysqli_query($con,$QueryCadastro);
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Lista Vip</title>
<link rel="stylesheet" href="template.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script><scriptsrc="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src='https://www.google.com/recaptcha/api.js'></script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>
$(function() {
$('#data').datepicker({ beforeShowDay:
function(dt)
{
return [dt.getDay() == 1 || dt.getDay() == 3 ? false : true];
}
});
});
</script>
<script>
//Campo 1
jQuery(function($){
$.datepicker.regional['pt-BR'] = {
closeText: 'Fechar',
prevText: '<Anterior',
nextText: 'Próximo>',
currentText: 'Hoje',
monthNames: ['Janeiro','Fevereiro','Março','Abril','Maio','Junho',
'Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'],
monthNamesShort: ['Jan','Fev','Mar','Abr','Mai','Jun',
'Jul','Ago','Set','Out','Nov','Dez'],
dayNames: ['Domingo','Segunda-feira','Terça-feira','Quarta-feira','Quinta-feira','Sexta-feira','Sabado'],
dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','Sab'],
dayNamesMin: ['Dom','Seg','Ter','Qua','Qui','Sex','Sab'],
weekHeader: 'Sm',
dateFormat: 'dd/mm/yy',
firstDay: 0,
isRTL: false,
showMonthAfterYear: false,
maxwidth: 180,
yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['pt-BR']);
});
$(function() {
$( "#nascimento" ).datepicker({
changeMonth: true,
changeYear: true,
yearRange: "1900:2020",
onClose: function (dateText, inst) {
var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
$(this).datepicker('setDate', new Date(year, month, 1));
}
});
});
$(function() {
$( "#datepicker2" ).datepicker();
});
jQuery(function($){
JQuery(".Maeqst5 input").append('required','false');
});
$(function() {
$( "#datepicker3" ).datepicker();
});
$(function() {
$( "#datepicker4" ).datepicker();
});
$(function() {
$( "#datepicker5" ).datepicker();
});
//Desabilita o envio ao pressionar Enter
$('#form1').on('keyup keypress', function(e) {
var keyCode = e.keyCode || e.which;
if (keyCode === 13) {
e.preventDefault();
return false;
}
});
</script>
</head>
<body>
<div class="GlobalForm">
<?php
if($QueryCadastro==true){
?>
<div class="alert alert-success" role="alert">
<strong>Obrigado!</strong> Seu nome foi adicionado a lista.
</div>
<?php
}
?>
<form action="index.php" method="post">
<div class="form-group">
<label for="usr">Nome ou Apelido:</label>
<input type="text" class="form-control" id="nome" name="nome" required="true">
</div>
<div class="form-group">
<label for="usr">Deixe uma mensagem ou informe seus convidados:</label>
<textarea class="form-control" placeholder="Messagem" name="mensagem"></textarea>
</div>
<div class="form-group">
<label for="usr">Informe a data que deseja estar na lista vip:</label>
<input type="text" class="form-control" id="data" name="data" required="true">
</div>
<input type="submit" class="btn btn-info" value="Cadastar"><br/><br/><br/>
<div class="g-recaptcha" data-sitekey="6LdH3xoUAAAAANeEgXuavBhgqKukl3NJfFrz_ZMj"></div>
</form>
</div>
</body>