It's simple to delete a file with a form with this PHP code:
<?php
session_start();
$username = $_SESSION['username'];
$file = $_POST['delete_a_file2'];
$file2 = "files/$username/$picture";
unlink('files/$username/$picture');
if (!unlink($file2))
{
echo '<br><div align="center"><font size="4" color="white">***Error deleting $file.***</font></div><br>';
include "manage_files.php";
}
else
{
echo '<br><div align="center"><font size="4" color="white">$file has been deleted.</font></div><br>';
include "manage_files.php";
}
?>
What I'm not sure how to do is make a simple text link that I can click to delete a file. Should I replace $_POST with $_LINK or something? lol
10 points for the best working answer. Thanks!
<?php
session_start();
$username = $_SESSION['username'];
$file = $_POST['delete_a_file2'];
$file2 = "files/$username/$picture";
unlink('files/$username/$picture');
if (!unlink($file2))
{
echo '<br><div align="center"><font size="4" color="white">***Error deleting $file.***</font></div><br>';
include "manage_files.php";
}
else
{
echo '<br><div align="center"><font size="4" color="white">$file has been deleted.</font></div><br>';
include "manage_files.php";
}
?>
What I'm not sure how to do is make a simple text link that I can click to delete a file. Should I replace $_POST with $_LINK or something? lol

10 points for the best working answer. Thanks!