Hi I have data from database in postgresql. I show them like this
<form name="delete" id="delete action="<?php echo $PHP_SELF?>" onsubmit="return sprawdz()" method="post" >
<?php
echo"Aktualne terminy rezerwacji.";
$results=pg_query($connection,"select * from ulice_miasta");
echo "<table border=1>\n";
echo"<tr><td>Ulica</td><td>Miasto</td><td></td></tr>";
$i=0;
for($lt = 0; $lt < pg_num_rows($results); $lt++) {
echo "<tr>\n";
for($gt = 1; $gt < pg_num_fields($results); $gt++) {
echo "<td>" . pg_result($results, $lt, $gt) . "</td>\n";
}
for($gt = 0; $gt < 1; $gt++) {
$abc=pg_result($results,$lt,0);
echo
"<td>
<input type='submit' name='submit' value='delete'/>$abc</td>
<input type='hidden' name='delete' value=$abc/>";
}
echo "</tr>\n";
}
echo "</table>\n";
?>
</form>
On the line " <input type='submit' name='submit' value='delete'/>$abc</td>" the number is correct but after clicking on "delete" it send by POST the last number from the list.
Any advice ?
The table colums are like "ID", Street, City
"USUN" is a "Delete" button