-1
I have a code that has an input of type Month that generates a calendar with the values passed in the input, but it saves the values in this standard 2000-12, and I want to display the name of the month on top of the calendar but it is not possible because the month is passed in digits, there is some way to take the values directly from the input?
<body>
<?php
$datee = explode('-', $_POST['datac']);
$mes = $datee[1];
$ano = $datee[0];
$ultimo_dia = date("t", mktime(0,0,0,$mes,'01',$ano));
if ($mes == date('m')){
$dias = $ultimo_dia;
}elseif ( $mes == '') {
$mes = date('m');
$ano = date('o');
$dias = $ultimo_dia;
}else{
$dias = $ultimo_dia;
}
?>
<?php
echo '<h4>'.$mes. ' de ' .$ano.'</h4>';
?>
<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"><center>Terça</center></td>
<td width="80px"><center>Quarta</center></td>
<td width="80px"><center>Quinta</center></td>
<td width="80px"><center>Sexta</center></td>
<td width="80px"><center>Sábado</center></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>
Paste your code here if possible
– LucaoA
I’ve already put it, it’s giving an error because of the indefinite variables, but it works normally.
– Nikk 17016
Let me get this straight, you want to show the month name instead of the month number ?
– LucaoA
That’s right :D!!
– Nikk 17016