php - passing variables from dynamic table -
good morning, searching, couldn't find answer :( have table created dynamically data taken mssql:
$tabelka = ' <form action="index.php" method="post"> <table border =1 width=40% class="hovertable"><tr> <td width=10%><b>biuro</b></td> <td width=10%><b>drukarka</b></td> <td width=20%><b>toner</b></td> <td width=10%><b>na stanie</b></td> <td width=10%><b>zamówionych</b></td> <td width=10%><b>akcja</b></td></tr>'; $sql = 'select * raporttonerow'; if ($result = sqlsrv_query($conn, $sql)) { while ($row = sqlsrv_fetch_array($result)) { $tabelka .= ' <tr><td width=10%>'.$row['kodbiura'].'</td> <td width=10%>'.$row['nazwadrukarki'].'</td> <td width=20%>'.$row['toner'].'</td> <td width=10%> <input type="number" name="nastanie" size=10% maxlength=1 value="'.$row['nastanie'].'"></td> <td width=10%><input type="number" name="zamowionych" size=10% maxlength=1 value="'.$row['zamowionych'].'"></td> <td width=10%><input type="submit" value="aktualizuj" name="akt"></td>'; } } $tabelka .= '</form></table>';
and
if (isset($_post['akt'])) { echo "test ".$_post['zamowionych'];
}
it showing me last data table. how can pass variables each row? want have is: when user click on button on row data row send in form.
thank lukasz
<?php while($row=mysql_fetch_array($sql)) { ?> <td> <?php echo $row->kodbiura;?></td> <td> <?php echo $row->nazwadrukarki; ?></td> <td> <?php echo $row->toner; ?></td> <?php }?>
Comments
Post a Comment