Re: Confirm message box
| From: | Marek Kilimajer | Date: | Wed, 27 Nov 2002 11:17:20 +0000 |
| Subject: | Re: Confirm message box | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-126259@lists.php.net to get a copy of this message | ||
I use this javascript code:
function confirmAction(question, uri) {
if(confirm(question)){
document.location=uri + '&confirm=1';} return false; } create link like this: <a href="delete.php" onclick="return confirmAction('Do you really ...?','delete.php?')">delete</a> If user has javascript enabled, on delete.php you will get $_GET['confirm']=1, and you know the action has been confirmed and go straight to deleting. If user has no javascript, you won't receive $_GET['confirm'], thus you know you need to confirm the action using php/html. PS: even if you don't need parameters to your script, add at least ? for it to work. Wilmar Perez wrote:
Hello guys
I have an script that just shows a list of names brought from a data base as this:
name 1
name 2
etc...
I want to have the following:
name 1 Delete
name 2 Delete
etc...
And when the user hits the Delete link a pop up dialog box (javascript style) asks for confirmation.
I guess this is a simple task but being my first time mixing php and javascript variables I'm a bit confused. It would be nice if someone could point me at an example or a tutorial that may help me (I already did some searching but couldn't find anything useful).
Thanks a lot
*******************************************************
Wilmar Pérez
Network Administrator
Library System
Tel: ++57(4)2105962
University of Antioquia
Medellín - Colombia
2002 *******************************************************