<?php
if(isset($_POST['fname']))
{
if(!empty($_POST['fname']))
{
$name=$_POST['fname'].'.txt';
if(@!unlink($name))
{
echo 'there is no file to delete';
}
else
echo 'file successfully deleted';
}
}
?>
<form action="file-delete.php" method="POST">
file name : <input type="text" name="fname">
.txt
<input type="submit" value="submit">
</form>
output :
note :
1) enter the file name for delete that text file
if(isset($_POST['fname']))
{
if(!empty($_POST['fname']))
{
$name=$_POST['fname'].'.txt';
if(@!unlink($name))
{
echo 'there is no file to delete';
}
else
echo 'file successfully deleted';
}
}
?>
<form action="file-delete.php" method="POST">
file name : <input type="text" name="fname">
.txt
<input type="submit" value="submit">
</form>
output :
note :
1) enter the file name for delete that text file