If I have a loop that requests my data from my form:
for ($i=0;$i < count($_POST['checkbx']);$i++) {
// calculate the file from the checkbx
$filename = $_POST['checkbx'][$i];
$clearfilename = substr($filename, strrpos ($filename, "/") + 1);
echo "'".$filename."',";
}
How do I add that into the sample array below?:
$files = array(
'files.extension',
'files.extension',
);
OR
Probably like this:
I'm not entirely sure what you want to add to that array, but here is the general method of 'pushing' data into an array using php:
for example you could do:
You can use the array_push function :
Will give :
Simply fill the array using array_push for each file.
Remember that you also need to name these checkboxes in HTML with "[]" after their names. e.g.:
You will then be able to access them thusly:
Even smaller:
If you aren't absolutely sure that
$_POST['checkbx']
exists and is an array you should prolly do: