I use this javascript code:

function confirmAction(question, uri) {
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

I want to have the following:

name 1 Delete
name 2 Delete

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 *******************************************************

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

Reply via email to