im trying delete a row on php (i did it) but, always delete the last row, i know why... because everytime i refresh or enter in the page, everytime i got id = "lastrow", my issue is, i dont know why everytime i got the last row id...`$query = "SELECT * FROM ph"; $rs = mysql_query($query);
while ($ph = mysql_fetch_array($rs)) {
echo utf8_encode("
<tr class='etapastext'>
<td >
".$ph['name']."
</td>
<td>
<input type='submit' name='".$ph['id']."' value='Eliminar' >
<input type='hidden' name='name' value='".$ph['id']."'>
</td>
"); }`
then i can access the id of the item i wish to delete, i use this code
$query = "DELETE FROM ph WHERE ph.id = '".$_POST['name']."'";
mysql_query($query);
i'm using $_POST['name'] because is an form, well i dont know if im doing the best way or what im doing bad
i echoed $query i got DELETE FROM ph WHERE ph.id = '24' when "24" is always the last row on my table