1
I have the following period:
15/10/2017 a 14/11/2017
(with selected option Monday, Tuesday, Wednesday, Thursday and Friday - Saturday and Sunday are inactive)
I need, through PHP, to build a loop for me to list all available dates based on that period, and also based on the days of the week that were selected.
In this case, the result would be:
16/10/2017
17/10/2017
18/10/2017
19/10/2017
20/10/2017
21/22 são sábado e domingo, por isso não listariam
23/10/2017
24/10/2017
25/10/2017
How could I do this?
To make it easier, I worked out this way:
<?php
header('Content-type: text/html; charset=UTF-8');
if(isset($_POST['inicio']) && isset($_POST['fim'])){
echo "<pre>";
print_r($_POST);
echo "</pre>";
}
?>
<form enctype="multipart/form-data" method="post">
<input type="date" id="inicio" name="inicio"><br>
<input type="date" id="fim" name="fim"><br><br>
<input type="checkbox" id="diasemana[]" name="diasemana[]" value="segunda">Segunda<br>
<input type="checkbox" id="diasemana[]" name="diasemana[]" value="terca">Terça<br>
<input type="checkbox" id="diasemana[]" name="diasemana[]" value="quarta">Quarta<br>
<input type="checkbox" id="diasemana[]" name="diasemana[]" value="quinta">Quinta<br>
<input type="checkbox" id="diasemana[]" name="diasemana[]" value="sexta">Sexta<br>
<input type="checkbox" id="diasemana[]" name="diasemana[]" value="sabado">Sábado<br>
<input type="checkbox" id="diasemana[]" name="diasemana[]" value="domingo">Domingo<br><br>
<input type="submit" value="Montar Rotina">
</form>