Ciao, se provo ad eseguire questo codice, mi da errori sulle variabili
(Notice: Use of undefined constant numSerate - assumed 'numSerate' in D:...insertEvento.php on line 53)
codice:
questo è il codice dell'intera pagina.codice:<?php $x = ($_POST[numSerate]-1); $y = ($_POST[maxPezzi]/(($_POST[numSerate]-1))); for($j=0;$j<$x;$j++){ # 4 = numero serate echo 'serata x '; for ($i =0;$i<$y;$i++){ #5 = numbero canzoni per serata echo' <tr><td><input type="text" name="codCanzone"></td> <td><input type="text" name="Titolo"></td> <td><input type="text" name="durata"></td> <td><input type="text" name="Autore"></td></tr>'; } } ?>
vi ringrazio in anticipo,codice:<html> <link type="text/css" rel="stylesheet" href="CSSstyle.css" title="Style" media="all" /> </html> <?php include 'Funzioni.php'; //BarrAdm(); $con=Connession(); $sql="INSERT INTO Evento (codEvento, nome, dataInizio, dataFine, presentatore, maxPezzi, numSerate) VALUES ('$_POST[codEvento]','$_POST[nome]','$_POST[dataInizio]','$_POST[dataFine]','$_POST[presentatore]','$_POST[maxPezzi]','$_POST[numSerate]')"; if (!mysql_query($sql)) { die('Error: ' . mysql_error($con)); } echo "<font color='white'>L'evento $_POST[nome] è stato creato!</font>"; echo " <table border='1'> <tr><th>Codice</th> <th>Nome</th> <th>Data Inizio</th> <th>Data Fine</th> <th>Presentatore</th> <th>Numero Brani</th> <th>Numero Serate</th></tr> <tr><th>$_POST[codEvento]</th> <th>$_POST[nome]</th> <th>$_POST[dataInizio]</th> <th>$_POST[dataFine]</th> <th>$_POST[presentatore]</th> <th>$_POST[maxPezzi]</th> <th>$_POST[numSerate]</th> </tr> "; mysql_close($con); ?> <html> <head> </head> <body> <font color='white'>Inserisci canzoni</font> <form action="canzoniInserite.php" method="post"> <table border ="1"> <tr> <td>Codice canzone</td> <td>Titolo</td> <td>Durata</td> <td>Autore</td></tr> <?php $x = ($_POST[numSerate]-1); $y = ($_POST[maxPezzi]/(($_POST[numSerate]-1))); for($j=0;$j<$x;$j++){ # 4 = numero serate echo 'serata x '; for ($i =0;$i<$y;$i++){ #5 = numbero canzoni per serata echo' <tr><td><input type="text" name="codCanzone"></td> <td><input type="text" name="Titolo"></td> <td><input type="text" name="durata"></td> <td><input type="text" name="Autore"></td></tr>'; } } ?> </table> <input type="submit" value="Inserisci"> </form> </body> </html>
L.

Rispondi quotando