HalfaBee wrote:You are confusing yourself with php and javascript.
The php will execute when the page is called.
The javascript will run when the button is clicked.
You need to create a seperate php script to do the deletions, search for AJAX and you should get some useful info.
Thank you for your input.
Well, I see what you're saying. I thought I could solve this by making a user-defined function to handle the deletion, putting this function in an included file, and then calling the function when the button is clicked. This didn't work either; the unlink() still occurred on page load (I guess since the included file was preprocessed along with the rest of the page, like you're saying). I guess I haven't tried putting the include inside the button's action script, but something tells me this won't work either.
I guess it'll have to be ajax, since it appears there's no way to avoid the preprocessing.