Ciao a tutti devo realizzare una tabella tramite un ciclo FOR .
Allego un esempio
La mia tabella è un po’ più ampia e volevo sapere se tramite la form posso recuperare tutti i dati che vengono inseriti tramite il metodo POST ed eventualmente come recuperarli?
Grazie a tutti in anticipo
Allego un esempio
PHP:
<form method="post" action="compilascheda.php">
<table border="1">
<?php
$fasi = array ('colazione','meta mattina','pranzo','primo pomeriggio','cena');
$giorni = array('Lunedi','Martedi','Mercoledi','Giovedi','Venerdi','Sabato','Domenica');
for ($num = 0; $num <= 2; ++$num)
{
echo "<tbody>
<tr><th>$giorni[$num] </th>";
for ($cont = 0; $cont < 2; ++$cont)
{
echo "<td> <legend>"."Valori"."</legend>
<select name=".$fasi[$cont]." >";
$comandoSQL = "select * from alimenti where fasegiornata='$fasi[$cont]'";
$risultato = @mysqli_query($conn, $comandoSQL);
while ($riga = mysqli_fetch_assoc($risultato) )
{
echo "<option value='".$riga['alimento']."' ";
echo "> ".$riga['alimento']."</option>";
}
echo "<legend>Qt</legend>
<input type="."text"." value='' size=4 name=quantita>";
}
echo "</select></td> ";
}
echo "</tr><br> ";
echo "</tbody></table>";
?>
<input type="submit" name="submit" value="Invia">
</table>
</form>
Grazie a tutti in anticipo
Ultima modifica: