I need to work on 2 errors.
The first one is the date: it shows a very rare date format: "Fecha de vuelta: 1637794800". It should show the date you put + 10 days.
The second one are the 2 things Visual Studio Code says are wrong: .length and isNaN
<html>
<head>
<title>lapuente_de la pena_blanca_ModuloDWES_TareaEvaluativa02.php</title>
</head>
<body>
<?php
if (isset($_GET['enviar'])) {
if (isset($_GET['fechaalquiler']) && ($_GET['fechaalquiler']!==null) && ($_GET['fechaalquiler']!=='')) {
echo "Fecha de vuelta: ".gmdate(strtotime($_GET['fechaalquiler']."+ 10 days"))."<br/>"; // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
} else {echo "Fecha no introducida <br/>";}
if (isset($_GET['dni']) && ($_GET['dni']!==null) && ($_GET['dni']!=='') && substr("TRWAGMYFPDXBNJZSQVHLCKEO", (int)(substr(($_GET['dni']), 0, 8)) % 23, 1)==substr(($_GET['dni']), 8, 1)) {
echo "DNI correcto";
} else if (!$_GET['dni']) {
echo "DNI no introducido";
} else if ($_GET['dni'].length!==9 || isNaN(substr(($_GET['dni']), 0, 8))) { // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
echo "DNI incorrecto";
} else {
echo "DNI incorrecto; la letra correcta sería ".substr("TRWAGMYFPDXBNJZSQVHLCKEO", (int)(substr(($_GET['dni']), 0, 8)) % 23, 1);
}
} ?>
<form name="input" action="<?php echo $_SERVER['PHP_SELF'];?>" method="get">
<label for="Fecha alquiler">Fecha alquiler</label>
<input name="fechaalquiler" type="date">
<?php echo "<br/>"?>
<label for="DNI">DNI</label>
<input name="dni" type="text">
<br />
<input type="submit" value="Enviar" name="enviar"/>
</form>
</body>
</html>
Thanks to the comments, I could resolve the questions
For the first error: date('Y-m-d H:i:s', strtotime($_GET['fechaalquiler']."+ 10 days"))
For the second errors: strlen($_GET['dni'])!==9 and !is_numeric(substr(($_GET['dni']), 0, 8))