PDA

View Full Version : Deleting a record


lux
11-21-2006, 07:02 PM
Hey davidj,

I use text instead of buttons in my forms when deleting a record from a database table and use this javascript to open a diolog box to confirm the users choice.

onclick="return confirm('Are you sure you want to delete?')

It is very simple and helps when users accidently click on the wrong delete text.

Would this work in your example where your using a button instead of text as you already use onClick for a different purpose?

davidj
11-21-2006, 07:33 PM
of course

just replace the button with the text

what i would do is create a function to call

example...


function del(){

y = confirm("message is true");

if (y){

document.location.href='delete.php?del=1';

}

}


then wrap your delete statement in an IF



if($_GET['del']){

*** delete statement here ***

}

lux
11-21-2006, 09:50 PM
yeah cool,

cheers for that

davidj
11-21-2006, 09:52 PM
working your last problem now!!!!!

its a doosy

lux
11-21-2006, 10:58 PM
hehe,

while i have been working on other things ive been looking at it too! ahhhhh