Posted by Joe Scylla on 05/23/07 09:27
Geoff Berrow wrote:
> Message-ID: <4653f9c2$0$328$e4fe514c@news.xs4all.nl> from Erwin Moller
> contained the following:
>
>>> 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
>> Wrong group again dude. ;-)
>>
>> Try comp.lang.javascript.
>
> EEEK! No! If that page ever accidentally got spidered, all the records
> would be deleted. Spiders don't run JavaScript, they just 'click'
> links.
>
> PHP would be better. I usually pass items to be deleted to an interim
> page (store them in a session or hidden field) and ask users to click a
> button to confirm the delete.
well if a guest user (like a spider) is able to delete you've made
something terrible wrong ;).
Also afaik spider don't execute javascript code.
I use a solution like this:
<a href="#" onclick="gui_delete('delete.php?id=123');">delete</a>
function gui_delete(url)
{
var r = confirm("Delete entry?");
if (r)
{
document.location.href = url;
}
}
Navigation:
[Reply to this message]
|