Right now I have code that allows me to submit text in order to create a .htm file on my server automatically.

I wish to also be able to delete a certain file from the server.

Here is the code I have now that allows me to create files on my server:
Code:
Form:
<form method="post" action="activate.php">
  <input name="textarea" type="text" value="">

<input value="Submit" type="submit">
</form>

Activate.php:
<?php
$textarea = $_POST['textarea'];
$textarea = str_replace("\r", "", $textarea);
$textarea = str_replace("\n", "", $textarea);
$textarea = str_replace("\r\n", "", $textarea);
$textarea = str_replace("\n\r", "", $textarea);
$textarea = trim($textarea);
$textarea = str_replace(" ", "_", $textarea);
$file = fopen($textarea . ".htm", "x");
fwrite($file, "authorized");
fclose($file);
chmod($textarea . ".htm", 0777);
?>

I would like code that allows me to delete the file i specify from the server. (permissions are set to do this)


For example, If i added another form to the page, istead of creating the file, delete it.

<form method="post" action="activate.php">
<input name="textarea" type="text" value="DELETETHISFILE.HTM">

<input value="Submit" type="submit">
</form>

Submitting the above form would delete "DELETETHISFILE.HTM" off the server.


Please, thanks.