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 Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted November 19, 2013 Share Posted November 19, 2013 (edited) 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! Edited November 19, 2013 by Ch0cu3r Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.