Posted by countach on 05/23/07 10:48
En las nuevas, el shotokan99 escribiσ:
> i have this code that when the user click it will delete the record:
>
> echo' <td bgcolor="'.$color.'" width="40"><font face="Verdana"
> size="1">
> <a href="del.php?id='.$id.'&dbf='.$dbf_new.'">delete</a></
> font></td>';
>
> i wanted to do a little confirmation before commiting the action. how
> to do it?
>
> tnx
A idea:
$h='';
switch ($_GET['delphase'])
case 'conf':
// Asking for delete
$h.= 'Deleting file '.$id.'?<br>';
$h.= '<a href="del.php?id='.$id.'&dbf='.$dbf_new.'&delphase=delok">OK!</a>
';
$h.= '<a
href="del.php?id='.$id.'&dbf='.$dbf_new.'&delphase=delcancel">Cancel</a>';
break;
case 'delok':
// Answer OK
ulink ($id); // OR whatever you must do to delete the file
$h.= 'File '.$id.' deleted!<br>';
break;
case 'delcancel':
// Answer Cancel
$h = 'Deleting file '.$id.' not done';
// Not breaking to let normal text (default part) show
default:
// Normal behabiour, note the use of delphase parameter
$h.= '<a
href="del.php?id='.$id.'&dbf='.$dbf_new.'&delphase=conf">delete</a>';
break;
}
echo' <td bgcolor="'.$color.'" width="40"><font face="Verdana" size="1">';
echo $h;
echo '</ font></td>';
Hope it works for you.
[Back to original message]
|