John Davidson

javascript - First condition can't run (can't print the date according to the input date form)

0 comments
Message:


The code can't run the first condition if (can't print the date according to the input date form)


<!DOCTYPE html>
<html>
<body>

<?php
date_default_timezone_set("Europe/London"); //Set your timezone
$date = new DateTime;
?>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<!-- today date-->
<input type="date" name="today" value="<?php echo $date->format('Y-m-d'); ?>">
<input type="submit" name="test" value="test">
</form>

<?php
if(isset($_POST['today'])){
$datePOST = new DateTime($_POST['today']);
echo $datePOST->format('d/m/Y');}ELSE{echo 'ss';}
?>

</body>
</html>


My Answer:
be checked using the if statement. For example:

javascript
let x = 10;

if (x > 5) {
console.log("x is greater than 5");
}


This code will check if the value of `x` is greater than 5 and if it is, it will print "x is greater than 5" to the console.

Rate this post

4 of 5 based on 7200 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us