Hai I want to set javascript variable (getdate1) as PHP variable to compare the dates with database value to display event details. I attached the attachement of how alert box will work.
var getdate1 = document.getElementById("eventDayName").innerHTML = selectedDate.toLocaleString("en-US", {
month: "long",
day: "numeric",
year: "numeric"
});
alert(getdate1);
HTML: <input type='hidden' id='myDate' name='myDate'>
JS: document.getElementById('myDate').value = getDate1;
PHP: $date = $_POST['myDate'];
Explanation: Make a hidden html element. Set its value with javascript. Get its value with PHP.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.