I am having difficulty deleting rows from my database.
I have a delete button in a form that when it is clicked then performs a DELETE FROM query but it doesnt work and Im wondering whether my theory is completly wrong (the theory being that having a form and submit button to INSERT data into a database works so why not use that to delete stuff? This is the code
$league_id = $_GET['id'];
$delete_entry = "<form action=\"".$_SERVER["REQUEST_URI"]."\ method=\"post\">
<input type=\"submit\" name=\"ooops\" value=\"Delete Entries\"></p>
</form>";
if ($_POST['ooops']) { //if the data is rubbish then delete and start again...
$delete_lge_sql = "DELETE FROM st_position WHERE league_id = '$league_id'";
$delete_lge_res = mysqli_query($statto, $delete_lge_sql)
or die(mysqli_error($statto));
}
When I click Delete Entries the page reloads and the URL looks like this
page.php?ooops=Delete+Entries
Many thanks for any help
You missed a double-quote in this statement
Change it to