Re: PHP delete confirmation
| From: | Geoff Lane | Date: | Fri, 29 Apr 2011 07:06:58 +0000 |
| Subject: | Re: PHP delete confirmation | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-312563@lists.php.net to get a copy of this message | ||
On Friday, April 29, 2011, admin@buskirkgraphics.com wrote:
> Personally I would use the javascript page navigation is senseless if they
> miss click.
> Javascript: Small and simple javascript.
> onclick="return confirm('Are you sure you want to delete?')"
Personally, I'd use Javascript and also check that the form was
submitted after the client-side check. So something like a hidden
field ('jstest') in the client-side form that is set to 1 by the
onClick event prior to showing the confirmation box. Then in the
handling PHP:
if ($_POST['jstest'] == 1){
// the client called us via Javascript::confirm, so we know the
// use really wants to delete
} else {
// We weren't called via Javascript::confirm, so we need to
// handle the confirmation in PHP
}
HTH,
--
Geoff