Good morning, I have a "ready" code where the user must register an event that will later be shown in a calendar, well the first part is ready and the second is giving me problems, I would like to do a check of the start date and end date and enter a text (Ex: event !!) on days between these dates, PS: dates are acquired via database, all data is already saved
For example: start date 6/6/16 end date 16/6/16, text should appear every day from 6 to 16
<?php
include 'connect.php';
$sql = "select Data_inicio, Data_fim from walldata";
$result = mysqli_query($con, $sql);
if ($result->num_rows > 0) {
while ($row = mysqli_fetch_assoc($result)) {
$Data_in = $row['Data_inicio'];
$Data_fim = $row['Data_fim'];
}
}
if (isset($_POST['datac'])) {
$datee = explode('-', $_POST['datac']);
$mes = $datee[1];
$ano = $datee[0];
$ultimo_dia = date("t", mktime(0, 0, 0, $mes, '01', $ano));
} else {
$mes = date('m');
$ano = date('o');
}
if ($mes == date('m')) {
$ultimo_dia = date("t", mktime(0, 0, 0, $mes, '01', $ano));
$dias = $ultimo_dia;
} elseif ($mes == '') {
$mes = date('m');
$ano = date('o');
$dias = $ultimo_dia;
} else {
$dias = $ultimo_dia;
}
?>
<form method="post" action="date.php">
<input type="month" name="datac" value="<?php echo $ano ?>-<?php echo $mes ?>" required><input type="submit">
<table class="table table-striped" width="210" border="2" cellspacing="4" cellpadding="4">
<tr>
<td width="80px"><center>Domingo</center></td>
<td width="80px"><center>Segunda</center></td>
<td width="80px" class="center">Terça</td>
<td width="80px" class="center">Quarta</td>
<td width="80px" class="center">Quinta</td>
<td width="80px" class="center">Sexta</td>
<td width="80px" class="center">Sábado</td>
</tr>
<?php
echo "<tr>";
for ($i = 1; $i <= $dias; $i++) {
$diadasemana = date("w", mktime(0, 0, 0, $mes, $i, $ano));
$cont = 0;
if ($i == 1) {
while ($cont < $diadasemana) {
echo "<td></td>";
$cont++;
}
}
echo "<td width='100px' height='100px'><center>";
echo $i;
echo "</center></td>";
if ($diadasemana == 6) {
echo "</tr>";
echo "<tr>";
}
}
echo "</tr>";
?>
</table>
</form>
</body>
</html>