Jump to content

Deletion Confirmation


son
 Share

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...