Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

saving selected array value to a variable

$
0
0
i have created an array to save the selected files in my folder and display these value in a dropdown box but i want to save the selected file which i can call later to view in a table. here the code i got so far to put the file into a dropdown box

$dir = opendir("C:/xampp/htdocs/xml");

//List files in images directory
while (($file = readdir($dir)) !== false)
  {
	  $last4 = substr($file, -4); 
	  if ($last4 == ".xml")
	  {
		 $files[] = $file;
		  
	  }
  }
closedir($dir);


printf ('<select>');

foreach($files as $let => $val){
	printf ('<option value="'.$let.'">'.$val.'</option>');
	
}
printf ('</select>');

?>

Viewing all articles
Browse latest Browse all 51036

Trending Articles