This is the table i created , so when i press the Edit button it should bring me to another page to edit. For the first edit button on the first row it does not work however for the rest of the edit button on the second row onward it works. Please help. Thank you !
<table border='1'>
<tr>
<th width='120'>Production ID</th>
<th width='120'>Description</th>
<th width='120'>BOM</th>
</tr>
<?php
for ($i = 0; $i < $num; $i++) {
$fetch = mysqli_fetch_row($select);
echo "<tr>
<td>" . $fetch[0] . "</td>
<td>" . $fetch[1] . "</td>
<td>" . $fetch[2] . "</td>
<td><form action='AddProductMainEdit.php?prodid' method='GET'><input type='hidden' value='".$fetch[0]."' name='prodid'><input type='submit' id='edit' value='Edit'></form></td>
</tr>";
}
?>
</table>
Try this:
<table border='1'>
<tr>
<th width='120'>Production ID</th>
<th width='120'>Description</th>
<th width='120'>BOM</th>
</tr>
<?php
while ($fetch=mysqli_fetch_row($select)) {
echo "<tr>
<td>" . $fetch[0] . "</td>
<td>" . $fetch[1] . "</td>
<td>" . $fetch[2] . "</td>
<td><form action='AddProductMainEdit.php' method='GET'><input type='hidden' value='".$fetch[0]."' name='prodid'><input type='submit' id='edit' value='Edit'></form></td>
</tr>";
}
?>
</table>
You don't need to add the variable prodid
to the url, the get method add all the variables to the url.