Re: How do I use a confirm box to confirm before deletion from a database
| From: | Girish Nath | Date: | Mon, 28 Jan 2002 15:16:45 +0000 |
| Subject: | Re: How do I use a confirm box to confirm before deletion from a database | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-82415@lists.php.net to get a copy of this message | ||
Hi
If you have a delete "link" then try this :
<script language="javascript">
function confirmThis(url) {
if (confirm("Are you sure you want to delete ?")) {
window.location = url;
}
}
</script>
Then you can generate the delete link dynamically with PHP eg :
<a href="javascript:confirmThis('delete.php?id=xxx')">Delete!</a>
This should pop up a OK/Cancel dialog box type confirmation.
Regards
Girish
--
www.girishnath.co.uk
----- Original Message -----
From: "Ivan Carey" <icarey@iname.com>
To: <php-general@lists.php.net>
Sent: Monday, January 28, 2002 12:09 PM
Subject: [PHP] How do I use a confirm box to confirm before deletion from a
database
Hello,
Thankyou for your reply.
When a user clicks upon a delete link that deletes a record from a database,
I would like to be able to give them the option to OK or Cancel this action.
I have tried coding the browsers built in confirm box (I can bring up this)
but am unable to combine it with php or a combination of php and a
javascript funtion
Thanks,
Ivan