Salve a tutti,
ho un nuovo problema (e non sarà l'ultimo sicuramente )
Praticamente io ho un form contente un campo così:
codice:echo "<form action='inserisci.php' method='post'"; echo "<input type='number' min='1' max='99' autocomplete='off' name='quantita[]' value='{$row['quantita']}'/>"
Praticamente ha come valore base {$row['quantita']} che vengono estratti da una taballa del database mysql! E fin qui tutto bene! Però se io volessi modificare il valore estratto dal database (essendo un campo di tipo input type=number) come faccio? Ogni qual volta eseguo il submit attraverso la pagina inserisci.php (per poter inserire i valori selezionati con le checkbox in un altra tabella) vengono estratti nuovamente i valori presenti nella prima tabella! ESEMPIO DEL CAMPO:
https://imgur.com/ad0ddWy
Posto il codice completo
inserisci.phpcodice:echo "<form action='inserisci.php' method='post' enctype='application/x-www-form-urlencoded'>"; echo "<table align='left' border='10' width='40%'"; echo "<tr><th></th><th>Qnt</th><th>Prodotto</th><th>Term</th><th>Data</th></tr>"; foreach ($pdo->query("SELECT * FROM tabella") as $row) { echo "<tr><td><input type='checkbox' name='selected[]' value='{$row['id']}'/><br /></td><td> <input type='number' min='1' max='99' autocomplete='off' name='quantita' value='{$row['quantita']}'/> </td><td>{$row['prodotto']}</td><td>{$row['terminale']}</td><td>{$row['data']}</td></tr>"; } echo "</table>"; ?> <table width="500" border="10"> <tr> <td width="987" align="center"><b>PRENOTAZIONE PRODOTTO</b></td> </tr> <tr> <td> <table width="633"> <tr> <td width="500">Nome:</td> <td width="420" align="left"><input type="text" autocomplete="off" name="nome" size="70" onkeyup="maiuscola(this)"/> </td> </tr> <tr> <td width="500">Cognome:</td> <td width="420" align="left"><input type="text" autocomplete="off" name="cognome" size="70" onkeyup="maiuscola(this)"/> </td> </tr> <tr> <td>Numero di tel.:</td> <td width="420" align="left"><input type="text" step="any" size="20" autocomplete="off" min="1" name="numero"/> </td> </tr> <tr> <td>Note:</td> <td width="420" align="left"><input type="text" autocomplete="off" size="70" name="note" onkeyup="maiuscola(this)"/> </td> </tr> <tr> <td></td> <td align="left"><input style="width:100px;" type="submit" value="Inserisci"/> </tr> </form> </table> </td> </tr> </table>
Se faccio un print_r($quantita); ottengo l'array dei valori quantita della prima tabellacodice:$nome = $_POST['nome']; $cognome = $_POST['cognome']; $quantita = $_POST['quantita']; $numero = $_POST['numero']; $note = $_POST['note'];