2011-02-13 6 views
0

私はthreadsという名前のフォルダを持っています。そのフォルダには他のフォルダがあります。これらのフォルダを配列に読み込んだり、選択ボックスに入れたりするのに問題があります。ここに私のコードです。ルートディレクトリのフォルダからディレクトリを取得するPHP

<select value="Please Select a Genre" > 
<?php 
$threads = array(); 
if ($handle = opendir('/Threads/')) { 
    while (false != ($file = readdir($handle))) { 
     if ($file != "." && $file != "..") { 

      array_push($threads,"$file"); 
      print_r ($threads); 


     } 
    } 
    sort($threads); 
    print_r ($threads); 
    for ($i = 0; $i < count($threads); $i++) { 

     print "<option value=\"$threads[$i]\">$threads[$i]</option>"; 
    } 


    closedir($handle); 
    ?> 

</select> 
<br /> 
<input type=\"submit\" name=\"submit\" value=\"Submit\" /> 
</form> 
</center> 
</body> 
</html> 
+1

と正確な問題は何ですか? – LeleDumbo

答えて

1

ソースコードに誤りがあります。

あなたが不足している決算}

<select value="Please Select a Genre" > 
<?php 
$threads = array(); 
if ($handle = opendir('/Threads/')) { 
    while (false != ($file = readdir($handle))) { 
     if ($file != "." && $file != "..") { 

      array_push($threads,"$file"); 
      print_r ($threads); 


     } 
    } 
} 
    sort($threads); 
    print_r ($threads); 
    for ($i = 0; $i < count($threads); $i++) { 

     print "<option value=\"$threads[$i]\">$threads[$i]</option>"; 
    } 


    closedir($handle); 
    ?> 
    </select> 
<br /> 
<input type=\"submit\" name=\"submit\" value=\"Submit\" /> 
</form> 
</center> 
</body> 
</html> 
関連する問題