There are a few problems here; my favorite is an error line 9 of your supposedly 3 line file. That one is referring to the extra [] after the $_POST['select'] in the line you posted. When you remove that though, best case scenario you're going to get another error, or your output is just going to read 'array'. you can't echo an array as an string unless you implode or join the elements. you have to print() or print_r() it, most prefer to do it like this:
Code: Select all
echo '<pre>Your array:<br />';//the pre tag makes it more readable, but try it with and without so you see
print_r($_POST['Select']);//play with this one also to see how associative and indexed arrays appear.
Also, just name your checkboxes with the filenames instead of trying to make an array etc. You're doing way more than you need to. the $_POST array will only contain keys (with the name of each control being the key) for the checkboxes that are checked. That means you can just do:
Code: Select all
if ($_POST){ //some older versions want you to use isset() but if you're up to date this will work
foreach ($_POST as $fname){
//your code here for each file
}
just make sure you don't name your submit input or you'll get more errors. Also, make sure you're cleaning those filenames in your code before doing anything with them, and using is_readable() and/or file_exists() to save yourself some headaches.