# \[PHP\] unlink problems

**URL:** <https://forum.kirupa.com/t/php-unlink-problems/220743>\
**Category:** Uncategorized\
**Created:** [March 28, 2007, 8:26pm UTC](https://forum.kirupa.com/t/php-unlink-problems/220743 "2007-03-28T20:26:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![danulf](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/danulf/32/555_2.png) [@danulf](https://forum.kirupa.com/u/danulf)\
**Post date:** [March 28, 2007, 8:26pm UTC](https://forum.kirupa.com/t/php-unlink-problems/220743/1 "2007-03-28T20:26:33Z")

</div>

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 😃

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

```php
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 🙂
