RE: [PHP] html forms in php
| From: | Alan Fullmer | Date: | Thu, 15 Sep 2005 18:46:29 +0000 |
| Subject: | RE: [PHP] html forms in php | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-222490@lists.php.net to get a copy of this message | ||
This might help you.
<input type="submit" name="DELETE" onclick="return
confirmDelete()">
<script>
function confirmDelete()
{
var agree=confirm("WARNING! This will blah blah delete etc yada yada
\n\rPress Cancel to go back, or OK to Continue.");
if (agree)
return true ;
else
return false ;
}
</script>
-----Original Message-----
From: Murray @ PlanetThoughtful [mailto:lists@planetthoughtful.org]
Sent: Thursday, September 15, 2005 12:32 PM
To: 'Philippe Reynolds'; php-general@lists.php.net
Subject: RE: [PHP] html forms in php
> Good day all,
>
> I have a problem for you all..
> I have a form that has has the ability to delete a lot of information from
> my MySQL database.
>
> I would like to create a bit of security, in case the user hits the button
> by accident.
> I would like to create an additionnal window that would appear that would
> ask:
> "Are you sure?" and then a "yes" and "no" buttons to confirm the
> deletion
> or
> to cancel the command.
>
> Any thougts??
Hi Phil,
You can achieve this in several ways. One would be to use a JavaScript
onClick event on the 'dangerous' button to pop up a dialog with your 'Are
you sure?' prompt and the yes/no buttons. If the user clicks on the 'no'
button, you use JavaScript to cancel the page submission. If they click on
the 'yes' button, the page submits. This approach would mean assuming that
your users have JavaScript enabled.
A second approach would be to have an intermediary page between the page
with the button, and the page that performs the actual delete. The
intermediary page would be little more than another form with the yes/no
buttons.
Much warmth,
Murray
---
"Lost in thought..."
http://www.planetthoughtful.org
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php