Elie S Elie S - 1 month ago 5
HTML Question

saving unique session variables in loop

I'm trying to loop through files in a directory, display them on a webpage, and save a unique session variable for each file, which I can then access on a separate php file that is called when the file is clicked.

if (is_dir($myuploadfolder)) foreach (scandir($myuploadfolder) as $filename){
if(($filename!="." && $filename!="..")){
echo "<a href='openFile.php'>$filename</a>";
//... save file in unique session variable to be accessed in other php file


In the for loop you could have form instead of href like so

echo"<form action='openFile.php' method='post'>";
//add a radio button for each file perhaps
echo"<input type='submit' value='submit' name='do something with $filename' />";

This is just an outline of what you could do easily