Re: PHP delete confirmation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Friday, April 29, 2011, admin@xxxxxxxxxxxxxxxxxxx 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


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux