Copy link to clipboard
Copied
I've built a PHP version of the Goto Detail Page link that goes to a mySQL/PHP DELETE records page.. but when I click on the link to go to that page (where it retrieves the record in a PHP recordset to get confirmation before deleting), instead the originating page just executes the delete (it looks like) and reloads minus the newly deleted file. I need to click on this link, go to the confirmation page so that they can decide for sure that they want to delete it, and click the submit button for the page to execute the Delete behavior.
Why? The code piece linking to the confirmation pages is:
<a href="del_entry.php?UID=<?php echo $row_Recordset1['UID']; ?>">Delete</a>
Help?
Copy link to clipboard
Copied
Hello Adrian
Why go to a confirmation page? You can accomplish this with less code, just use javascript. I have provided the code below:
Place this code in the head section of your PHP page
<script type="text/javascript">
function ConfirmDelete(){
var confDel = confirm("Are you sure you want to delete this record?")
return confDel
}
</script>
Now change your link from
This:
<a href="del_entry.php?UID=<?php echo $row_Recordset1['UID']; ?>">Delete</a>
to This:
<a href="del_entry.php?UID=<?php echo $row_Recordset1['UID']; ?>" title="Delete" onClick='return ConfirmDelete()'"; >Delete</a>
Notice the code in BOLD. This will call up an alert box that will display the ConfirmDelete text and allow the user to either go ahead and delete the record or cancel.
Hope this helps
Stan Forrest
Digital Magic Show
Copy link to clipboard
Copied
This is great Stan, and it works, the redirect afterwards goes to the target page, but adds on the unique ID string, screwing with that target page.. for example, it goes to:
http://www.domain.org/memberAdmin.php?entrynumber=1447
and I need to to just go to:
http://www.domain.org/memberAdmin.php
How can I tweak the DW code so I don't get the added URL stuff?
Find more inspiration, events, and resources on the new Adobe Community
Explore Now