krzysiekleb Posted November 18, 2013 Share Posted November 18, 2013 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" ><?phpecho"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 Link to comment https://forums.phpfreaks.com/topic/284040-php-addremove-table-postgresql/ Share on other sites More sharing options...
Ch0cu3r Posted November 19, 2013 Share Posted November 19, 2013 Have the delete button and hidden form fields in separate <form>'s. If you include all the delete/hidden fields within one form then only the last id will be sent! Link to comment https://forums.phpfreaks.com/topic/284040-php-addremove-table-postgresql/#findComment-1458944 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.