Jump to content

Deletion Confirmation


son

Recommended Posts

I have a simple script to delete data from db. How can I build in a message, which says "Are you sure you want to delete" before actually running the delete query? The code so far is:

if (isset($_GET['df']))	{	$df = (int) $_GET['df'];	$query = "DELETE FROM cms WHERE page_id = $df";	if ($result = mysqli_query ($dbc, $query))	{		echo "<h2>The file has been deleted!</h2>";		$query = "SELECT * FROM cms";		$result = mysqli_query ($dbc, $query);		echo "<form action=\"leftDelete.php\" method=\"get\">";echo "<fieldset>";echo "<select name=\"df\">";echo "<option value=\"select\">Select another file to delete?</option>";while ($row = mysqli_fetch_array ($result, MYSQLI_ASSOC))	{echo "<option value=\"{$row['page_id']}\">{$row['heading']}</option>\n";	}echo "</select>";echo "<span style=\"margin-left:20px;\"><input type=\"hidden\" name=\"submitted2\" value=\"TRUE\" />";echo "<input type=\"submit\" name=\"submit\" value=\"Delete\" /></span>";echo "</fieldset>";echo "</form>";		}	else	{		echo "Your submission could not be processed due to a system error";		}	}

If I have to work with sessions or similar: I use already one for user_id on page. Can you have several sessions as such?Son

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...