Hello, I am very new to PHP and I am trying to modify some code to be able to download several documents at a time. At the moment all I want to do is to pass the checked box values in the array to output them on the following page, but I can't get it working. 😕 😕
The code in my first page is as follows:
<form name="BulkDownload" action="out.BulkDownload.php" method="post">
<table cellspacing="5" cellpadding="0" border="0">
<?
$documents = $folder->getDocuments();
$documents = filterAccess($documents, $user, M_READ);
if (count($documents) > 0)
{
$rownum = count($documents)+1;
print "<tr>\n";
print "<td></td>\n";
print "<td class=\"filelist\" style=\"border-bottom: 1pt solid #000080;\"><i>".getMLText("name")."</i></td>\n";
print "<td rowspan=".$rownum." style=\"border-left: 1pt solid #000080;\"> </td>\n";
print "<td class=\"filelist\" style=\"border-bottom: 1pt solid #000080;\"><i>".getMLText("comment")."</i></td>\n";
print "<td rowspan=".$rownum." style=\"border-left: 1pt solid #000080;\"> </td>\n";
print "<td class=\"filelist\" style=\"border-bottom: 1pt solid #000080;\"><i>".getMLText("owner")."</i></td>\n";
print "</tr>\n";
foreach($documents as $document)
{
$owner = $document->getOwner();
$comment = $document->getComment();
if (strlen($comment) > 25) $comment = substr($comment, 0, 22) . "...";
print "<tr>";
print "<td><img src=\"images/file.gif\" width=18 height=18 border=0></td>";
print "<td class=\"filelist\"><input type=\"checkbox\" name=\"id" . $row[id] . "\" value=\"1\"><a class=\"filelist\" href=\"out.ViewDocument.php?documentid=".$document->getID()."\">" . $document->getName() . "</a></td>\n";
$idList .= $sep . $row[id];
$sep = ",";
print "<td class=\"filelist\">" . $comment . "</td>";
print "<td class=\"filelist\">".$owner->getFullName()."</td>";
print "</tr>";
}
}
else
print "<tr><td class=\"filelist\">".getMLText("no_documents")."</td></tr>";
?>
</table>
<? print "<input type=\"hidden\" name=\"idlist\" value=\"$idList\">" ?>
<input type="submit" value="Bulk Download"> </form>
Second page code:
<? $array_id = explode ("," "$idList");
foreach($array_id as $id){
if(${"id" . $id} == 1){
print ="$idList";
}
}
?>
Thank you.