I'm working toward creating website that lists all the files within a directory with a checkbox option, and if the checkbox is selected, an html submit button will run a python script to organize the contents of the file.
Right now I have a table of files with checkboxes, but I am having trouble connecting a marked checkbox with the proper file. Here's what I have:
<?php
$myDirectory = opendir(".");
//items don't want listed
$blacklist = array(".", "..", 'test.php');
while(false !== ($entryName = readdir($myDirectory))) {
if (!in_array($entryName, $blacklist)) {
$dirArray[] = $entryName;
//echo "$entryName\n";
}
}
closedir($myDirectory);
//count elements in array
$indexCount = count($dirArray);
//print table
echo ("<TABLE border=1 cellpadding=5 cellspacing=0 class= whitelinks>\n");
echo ("<TR><TH>CheckBox</TH><th>File Name</th></TR>\n");
// loop through array of files and print them all
for ($index=0; $index < $indexCount; $index++) {
if (substr("$dirArray[$index]", 0, 1) != ".") { //dont list hidden files
echo("<TR><TD><input type=\"checkbox\" name=\"comp[]\" value=\"$dirArray[$index]\"</td>");
echo("<td>");
echo("<a href=\"$dirArray[$index]\">$dirArray[$index]</a></td>");
echo("</TR>\n");
}
}
echo("</TABLE>\n");
?>
So just for now, how do I connect the marked checkboxes to the proper directory and check with a submit button with form action to a php
file to display which companies I have marked?
Aucun commentaire:
Enregistrer un commentaire