Buona sera... sto uscendo pazzo per un esame di php e mysql... questo è quello che ho scritto in php
Codice PHP:
if (isset($_GET['id_ricetta_idonea'])){
$sql = "insert into pub (matr_redattore, id_ricetta, data_pub, idonea) values ('".$_POST['redattore']."','".$_GET['id_ricetta_idonea']."', CURDATE(), '1')";
mysql_query($sql);
}
?>
<table width="*" border="0" align="center" valign="middle">
<tr class="header">
<th align="center">Seleziona il redattore che autentichera' la ricetta
<select name="redattore" id="redattore">
<option value="">redattore</option>
<?php
$sql = "select *, matr_redattore as mtr from redattore where capo='0' order by mtr asc";
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)){
?>
<option value="<?php echo $row['mtr'] ?>"><?php echo "ID - ".$row['mtr']." ".$row['cognome']." ".$row['nome']; ?></option>
<?php
}
?>
</select>
</th>
</tr>
<tr>
<td height="14">
</td>
</tr>
<tr>
<td>
<table width="*" align="center" valign="middle"border="1">
<tr class="sidebarHeader">
<th scope="col">Nome</th>
<th scope="col">Tipologia</th>
<th scope="col">Minuti Cottura</th>
<th scope="col">Calorie</th>
<th scope="col">Difficoltà</th>
<th scope="col">Stato</th>
</tr>
<?php
$sql = "select ricetta.id_ricetta as id, ricetta.*, pub.*, tipologia.* from ricetta left join pub on ricetta.id_ricetta=pub.id_ricetta left join tipologia on ricetta.id_tipologia = tipologia.id_tipologia";
$result = mysql_query($sql);
while ($row=mysql_fetch_assoc($result)){
?>
<tr>
<td><?php echo $row['nome'] ?></td>
<td><?php echo $row['tipo'] ?></td>
<td><?php echo $row['tempo_cottura'] ?></td>
<td><?php echo $row['calorie'] ?></td>
<td><?php echo $row['difficolta'] ?></td>
<td><?php
if ($row['idonea']==1)
echo "Validata";
else{
?>
[url="valida.php?id_ricetta_idonea=<?php echo $row['id'];?>"]click per inoltrare[/url]<?php ;
}?></td>
</tr>
<?php
} ?>
</table>
</td>
</tr>
</table>
Tutto funziona bene ma, il valore di $_POST['redattore'] non viene inserito nella tabella pub (viene memorizzato 0)... come mai? dove sbaglio
Grazie
dmiao83