I have a school calendar system that is in this template:
Ineedtoincludeinthedatabasethathasthisstructure:
Forexample:
Inthehoursof07:00to07:05,IchosetheMathematics,PortugueseandBiologysubjectsonMonday,WednesdayandFriday.
Andinthetimeof09:00to09:25,IchoseonTues,ThursandSatthesubjects:Philosophy,ChemistryandArts.
ButIcannot.
Seetheresult
I'mdoingthefollowing:
Gettingformdata
$horarioEntrada=$_POST["HorarioEntrada"];
$horarioSaida = $_POST["HorarioSaida"];
$materias = $_POST["Materias"];
echo $metodos->cadastrarGradeEscolar($horarioEntrada,$horarioSaida,$materias);
Schedules
<select class="form-control" name="HorarioEntrada[]" style="width:90px">
<?php
for($horarioInicio = 7; $horarioInicio <= 22; $horarioInicio++){
$horarioInicio = ($horarioInicio < 10)?("0".$horarioInicio):($horarioInicio);
?>
<option value="<?php echo $horarioInicio; ?>:00"><?php echo $horarioInicio; ?>:00</option>
<?php } ?>
</select>
<span class="input-group-addon" style="background-color: #FAFAFA">às</span>
<select class="form-control" name="HorarioSaida[]" style="width:90px">
<?php
$horaFinal = "07:00";
for($horaFim = 0; $horaFim < 180; $horaFim++){
$horaFinal = date('H:i', strtotime('+5 minute', strtotime($horaFinal)));
?>
<option value="<?php echo $horaFinal; ?>"><?php echo $horaFinal; ?></option>
<?php } ?>
?>
</select>
Matters
$sqlListar = mysqli_query($this->conexao,"SELECT * FROM pe_materias WHERE IdEscolas = '".$idEscolas."';");
$listar = "<select name='Materias[]' class='form-control'>";
$listar .= "<option value='Selecione'>Matéria</option>";
while($jmListar = mysqli_fetch_object($sqlListar)){
$listar .= "<option value='".$diaMateria."_".$jmListar->IdMaterias."'>".$jmListar->Materias."</option>";
}
$listar .= "</select>";
return $listar;
}
Method to signGradeSchool ()
public function cadastrarGradeEscolar($horarioEntrada,$horarioSaida,$materias){
foreach($horarioEntrada as $valor => $horaE){
for($i = 0; $i < count($materias); $i++){
if($materias[$i] != "Selecione"){
echo $horaE . "= " .$materias[$i];
}
}
}
}