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" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
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




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to