[PHP] unlink problems

I’ve started messing around in php lately as a part of my last project in school (yay? yay.) and yesterday I read something about deleting files. ;y question is: How do I delete a file that I don’t specify manually?

I have listed all the files in a directory, and I would like to be able to delete them. This is what my little brain can come up with, but I don’t know how to continue, or if it can be done this way :smiley:

This is the echo for printing out the files. It’s in a while loop

echo "<form action='delete.php' method='POST' name="$file">
<input type='submit' value='X' name='upload/$file' /></form>

What should I set as the forms name to make it understand what file I am talking about? I don’t want 30 buttons to delete the same file. Also, what to I need to put in delete.php? I tried putting some unlink thingie in there, but no workie.

Basically, I know nothing about unlink, and I haven’t really found anything that explains how it works with forms…

Help?

EDIT: I think I’m moving too fast for my own brain, but I have to fix this little problem before I can take a break from the project and actually learn php, so any help would be appreciated :slight_smile: