When I insert data (date) in my table and click on the add button it changes it into 0000-00-00 instead of the entered date. Please tell me how to store the date into the javascript variable.
//php code
<?php
$edate = mysqli_query($con, $_POST["edate"]);
$query = "INSERT INTO expenses(edate, details, spent) VALUES('$edate', '$details','$spent')";
?>
<script>
$(document).on('click', '#insert', function(){
var edate = $('#data1').text();
</script>