我有PHP页面,它从文件夹收集文件名并填充数组,然后该数组用于创建下拉列表。但我想提交选择和显示的值,以及我停止的地方。请帮忙。 提前致谢。
<?php
// open this directory
$myDirectory = opendir("Media/MP3_Para");
// get each entry
while($entryName = readdir($myDirectory)) {
$dirArray[] = $entryName;
}
// close directory
closedir($myDirectory);
// count elements in array
$indexCount = count($dirArray);
// sort 'em
sort($dirArray);
// create dropdown list
echo "<form method='POST' action='1.php' > " ;
echo "Change Selection : " ;
echo "<select name='my_select'>" ;
foreach($dirArray AS $index) {
// remove . or .. from list
if (substr("$index", 0, 1) != ".") {
$titlname1=$index ;
$name1=substr($titlname1,0,-4) ;
$titlname1=$name1 ;
echo '<option value="'.$index.'">'.$titlname1.'</option>' ;
}
}
echo '</select>';
echo "<input type='submit' class='NavLinks' " ;
echo "</form>" ;
echo my_select ;
?>
</body>