I have the following question, I have a while
in PHP, and in this while
I have a form and a submit button that sends this form , but as they are multiple records it repeats this form and the system only detects the first form from the list, the others it does not do submit , for example, I have 20 records, 20 forms are generated, however much I change form # 18, it will save 01. >
To get clearer, each record brings me a status of the product in a select
, and I want to leave this option of choice for the user, and when he chooses a status in that select
(which is in form ), the system does the update on the database.
this is the code that while repeating how many results it finds:
<?php
while ($dados = $produtos->fetch_array()) {
?>
<tbody> <tr>
<td align="center"><?php echo $dados['id_oc']; ?></td>
<td align="center"><?php echo date('d/m/Y', strtotime($dados['data'])); ?></td>
<td align="center"><?php echo (number_format($dados['total'],0,",",".")); ?></td>
<td align="center"><?php if(!empty($dados['faccao'])) echo $dados['faccao']; else echo "-"; ?></td>
<td align="center">
<form action="" method="post" name="teste">
<select name="status" id="status_">
<option value="<?php echo $dados['status']; ?>"><?php echo $dados['status']; ?></option>
<?php
foreach ($arrEdital as $value => $name) {
echo "<option value='{$name}'>{$name}</option>";
}
?>
</select>
<td align="center"><input type="submit" name="status2" id="ok" value="ok" /> </td>
</form>
</td>
</tr></tbody>
<?php
}
?>
The problem is that it repeats this 20 times (for example), but when I change the select from the number 18 (for example), it takes the values of the first form (number 1 in this example)