zipp Posted July 29, 2007 Share Posted July 29, 2007 Im trying to make a File managment system, I have gotten the files to display properly, now what I am trying to do is have a check box next to each file, that if clicked, when the form is submitted, the file will be deleted. I would like to be able to have more then 1 check box selected. html code (generated by php) <form enctype='multipart/form-data' method='POST' id='del' action='delete.php'> <input type='submit' value='Delete'></th> <tr><td colspan="2"><a href="/admin/admin-xxky.php?dir=upload/jackie">jackie</a></td> </tr> <tr> <td>-->aloud.wav</td> <td style="padding-left:40px;"><input type="checkbox" name="delete"></td> </tr> <tr> <td>-->howto.txt</td> <td style="padding-left:40px;"><input type="checkbox" name="delete"></td> </tr> <tr> <td>-->readme.txt</td> <td style="padding-left:40px;"><input type="checkbox" name="delete"></td> </tr> <tr><td colspan="2"><a href="/admin/admin-xxky.php?dir=upload/test2">test2</a></td> </tr> <tr> <td>-->New Text Document.txt</td> <td style="padding-left:40px;"><input type="checkbox" name="delete"></td> </tr> <tr><td colspan="2"><a href="/admin/admin-xxky.php?dir=upload/test">test</a></td> </tr> <tr> <td>-->New Flash ActionScript File.as</td> <td style="padding-left:40px;"><input type="checkbox" name="delete"></td> </tr> <tr> <td>-->New WinRAR ZIP archive.zip</td> <td style="padding-left:40px;"><input type="checkbox" name="delete"></td> </tr> <tr><td colspan="2"><a href="/admin/admin-xxky.php?dir=upload/tom">tom</a></td> </tr> <tr> <td>-->aloud.wav</td> <td style="padding-left:40px;"><input type="checkbox" name="delete"></td> </tr> <tr> <td>-->howto.txt</td> <td style="padding-left:40px;"><input type="checkbox" name="delete"></td> </tr> <tr> <td>-->readme.txt</td> <td style="padding-left:40px;"><input type="checkbox" name="delete"></td> </tr></table> delete.php code <?php if ($_REQUEST['delete']) { unlink($_REQUEST['delete']); } ?> Link to comment https://forums.phpfreaks.com/topic/62263-solved-file-managment-system/ Share on other sites More sharing options...
zq29 Posted July 29, 2007 Share Posted July 29, 2007 Change the name of your checkboxes from delete to delete[]. They will then be sent as an array. Link to comment https://forums.phpfreaks.com/topic/62263-solved-file-managment-system/#findComment-309953 Share on other sites More sharing options...
yarnold Posted July 29, 2007 Share Posted July 29, 2007 Also if I were you I would replace $_REQUEST with $_POST... It's a little more secure. Link to comment https://forums.phpfreaks.com/topic/62263-solved-file-managment-system/#findComment-309964 Share on other sites More sharing options...
zipp Posted July 30, 2007 Author Share Posted July 30, 2007 I thought that REQUEST was more secure then POST. thanks for the tip. As soon as I try the delete[] thing, ill edit my post accordingly. **edit** Thank you for your help, both responses where helpful. Topic solved. Link to comment https://forums.phpfreaks.com/topic/62263-solved-file-managment-system/#findComment-310624 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.