Jump to content

Recommended Posts

Hi, can someone give a sample how to delete selected checkboxes, wherein the selected checkboxes represents a file inside the same directory where the script resides. for example, I have 5 files in my directory, then I created an index.php file in order to show their names in a nice way via browser, and then I included a check box at the leftside of each name, and at the bottom is the delete button. is it possible to do that using only one single PHP file ?

here's my initial code

<html>
<head>
<meta name="robots" content="noindex" />
<meta name="googlebot" content="noindex" />
<link rel="stylesheet" type="text/css" href="http://METHODS/main.css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="http://METHODS/js.js"></script>
</head>
<body>
<?php
echo "<div><span id=\"title\">List of Files</span></div>";
?>

<table>
<?php


if ($handle = opendir('.')) {
   while (false !== ($file = readdir($handle))) {
       if ($file != "." && $file != "..") {
          if(strlen($file)-strpos($file,".swf")== 4){
            echo "<tr><td><input type=\"checkbox\" name=\"box[]\"></td><td><a href=\"$file\" target=\"_blank\">$file</a></td></tr>";
           }
       }
   }
   closedir($handle);
}


?>
</table>
<button type="button" name="Delete" value="Delete">Delete</button>
</body>
</html>

 

please tell me what to add  :confused:

Link to comment
https://forums.phpfreaks.com/topic/198981-file-deletion-help/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.