sasori Posted April 19, 2010 Share Posted April 19, 2010 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 Link to comment https://forums.phpfreaks.com/topic/198981-file-deletion-help/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.