0
I have a datepicker like this
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css" />
<form action="dashboard.php" name="form1" class="form1" method="POST">
<input type="text" id="dtSelectorStatic" />
</form>
</li>
And a script like that:
jQuery(function($) {
$("#dtSelectorStatic").datepicker({dateFormat: "dd-mm-yy"});
var d = new Date();
var month = d.getMonth()+1;
var day = d.getDate();
var output = d.getFullYear() + '/' +
(month<10 ? '0' : '') + month + '/' +
(day<10 ? '0' : '') + day;
$("#dtSelectorStatic").datepicker("setDate", new Date(output));
console.log(output);
$('#dtSelectorStatic').on('change', function() {
console.log('Submiting form');
console.log(output);
$('#form1').submit();
}).trigger('change');
});
I have a function to insert all data into the database and I need to pass this datepicker value to the insert function
Note: The whole code is on the same page . php
I don’t understand what you want
– Vinicius De Jesus
inputs need the tag
name
to be identified by the PHP script– Vinicius De Jesus
I want to use the variable "output" that contains the date chosen by the user for later on pressing the insert button, it insert in the database all the information plus the date, but I can’t use this variable "output" in php of the same page
– MiguelCampos