My method for this usualy looks something like this:
page1.php:
Someitem #123 [Delete] [Change]
Someitem #2 [Delete] [Change]
Now, upon pressing Delete which is a link that looks like:
page1.php?DELID=123
page1.php?DELID=123:
Sure you wish to Delete Someitem #123? [Yes/No]
Someitem #123 [Delete] [Change]
Someitem #2 [Delete] [Change]
Now the Yes link would look like:
page1.php?DELID=123&CONFIRMED=1
and clicking it would yield process it:
page1.php?DELID=123&CONFIRMED=1:
You have deleted Someitem #123.
Someitem #2 [Delete] [Change]
So something like this codeways:
<?PHP
if($GET["DELID"]>0 && $GET["CONFIRMED"]==1)
{
//Destroy whatever
$msg="You have destroyed something."; //Or an error msg if the destroy function failed...
}
elseif($_GET["DELID"]>0)
{
$msg="Sure you wish to Delete <nameofthing>? [<a href=\"page1.php?DELID=123&CONFIRMED=1\">Yes</a>/<a href=\"page1.php\">No</a>]";
}
?>
<html> etc etc etc
<body>
<?PHP print $msg; ?>
List of things to fiddle with.
</body>
</html>
Thats the quick and dirty way, without any security measures but that is easy enough to add. Hope this was what you wanted.
Originally posted by kcgame
I would like to do everything in the same page. Meaning that user will be shown with 'Yes' and 'No' buttons replacing the 'Destroy' button. Can anyone code me some examples? Where to input the codes?
If i want to pass the parameters to other forms, do i need global variables enabled? Can the parameters passed to other .php file if i use $_POST['destroydata1']