Jump to content

prisca91

New Members
  • Posts

    3
  • Joined

  • Last visited

prisca91's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Sorry but I'm a beginner and thought that the rmdir(array_dir[$b]) was enough to delete an empty directory. Do you mean I should write a function that deletes a directory and create a link to this function, and not a delete-button?
  2. <?php $conto=count($array_dir); echo"<table border=\"1\">"; for($b=0;$b<$conto;$b++){ echo"<tr><td width=\"300\" height=\"50\"><img src=\"folder.png\"><a href=$array_dir[$b]>".$array_dir[$b]."</a><br>"; echo"<form action='' name='deleteform".$b."' method='GET'>"; echo"<input type='submit' name='deletebut".$b."' value='Delete'>"; echo"</form></td><td>"; if(file_exists($array_dir[$b])) {if(isset($_GET['deletebut'.$b])) {if($_GET['deletebut'.$b]==$array_dir[$b]) {if(rmdir($array_dir[$b])) {echo $array_dir[$b]." was removed";} else {echo"Failed to remove directory ".$array_dir[$b];} } } ?> I think in this way it's properly indented but still doesn't work, so this is not the issue...
  3. Hi guys! I'm a beginner with php and need to write a code that displays a list of all folders present in the current work directory 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) for($b=0;$b<$conto;$b++){ echo"<tr><td width=\"300\" height=\"50\"><img src=\"folder.png\"><a href=$array_dir[$b]>".$array_dir[$b]."</a><br>"; echo"<form action='' name='deleteform".$b."' method='GET'>"; echo"<input type='submit' name='deletebut".$b."' value='Delete'>"; echo"</form></td><td>"; if(file_exists($array_dir[$b])) {if(isset($_GET['deletebut'.$b])) {if($_GET['deletebut'.$b]==$array_dir[$b]) {if(rmdir($array_dir[$b])) {echo $array_dir[$b]." was removed";} else {echo"Failed to remove directory ".$array_dir[$b];} } } } 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 !
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.