Here is my code:
$result = mysql_query ("SELECT * FROM $tbl_name WHERE username='$user'"); while($row = mysql_fetch_array($result)) { $username = $row['username']; $email = $row['password']; $age = $row['age']; $id = $row['id']; echo " <font size='3' face='arial'> <table width='250' border='0' cellspacing='1' cellpadding='0'> <tr> <td><b>$id, $username,$password,$email,$age</b></td> </tr> <tr> <td><form action=delete.php method=POST><input type=submit name=submit value=Remove></form></td> </tr> </table> </font> "; if(isset($_POST['submit'])) { $got_error = 0; mysql_query(" DELETE $id FROM $tbl_name); } else { $got_error = 1; echo "Error."; } }
I have multiple pieces of data. Each piece of data has its own submit buttton when displayed. If there is 2 pieces of data and I hit the top button, the bottom data is deleted. I want to make it so that if I hit the top button the top button is deleted. Please help.