I'm a beginner with php and need to write a code that displays a list of folders and a delete-button near each of them, in order to be able to cancel them. Here's my code: ($array_dir is an array containing the names of the directories in the current folder)
$conto=count($array_dir);
echo"<table>";
for ($b=0;$b<$conto;$b++) {
echo"<tr><td><a href=$array_dir[$b]>".$array_dir[$b].
"</a><br>";
echo"<form name='delete_dir_".$b."' action=
'".$_SERVER['PHP_SELF']."' method='GET'>";
echo"<input type='submit' name='butdelete".$b."' value='Delete'>";
echo"</form></td><td>";
$dir=$array_dir[$b];
if ((isset($_GET['butdelete".$b."'])) && ($_GET['butdelete".$b."']==$dir)) {
if(rmdir($dir)) {
echo"The directory ".$dir." has been removed";
}
else {
echo"Could not remove directory ".$dir;
}
}
}
This output looks fine but when I click on the delete-button it doesn't delete the folder and doesn't even return any error. I can't really understand where the error is !