Simple, yet efficient PHP Calendar
I need to have a calendar to use at a website, the thing is, that weekends shouldn't show up, and for each month, having different days,
I wrote a basic function, that has many flaws:
<?php
function marcardia () {
$meses = Array(1 => 'Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro');
echo "<Select>";
foreach ($meses as $开发者_JAVA百科key => $mes){
echo "<option>".$meses[$key]."</option>";
}
echo "</select>";
$dias = range(1,40);
echo "<Select>";
foreach ($dias as $key => $dia){
echo "<option>".$dias[$key]."</option>";
}
echo "</select>";
}
marcardia ();
?>
</p>
<p>Marque uma Hora<br/>
<?php
$horas=array(1 => '09:00', '10:00', '11:00', '12:00', '14:00', '15:00', '16:00', '17:00', '18:00');
$horaz = array();
echo '<select name="hora">';
foreach($horas as $key => $hora){
echo "<option value=\" $hora \"";
echo ">$hora</option> \n";
}
echo '</select>';
?>
I am in the process of learning PHP...
Have a look at PEAR's Calendar package. It's customizable and should be suitable for you.
精彩评论