下拉不再有效

时间:2015-08-06 14:47:45

标签: php html drop-down-menu

此Dropdown突然停止工作。 Dir没有改变,路径应该没问题。我希望一双新鲜的眼睛可以捕捉到我没有看到的东西。提前致谢。

  <select name="itinerarypath" type="text" id="itinerarypath">
          <option name="itinerarypath" type="text" id="itinerarypath" value="<?php echo $values['itinerarypath'] ?>" selected="selected"><?php echo $values['itinerarypath'] ?></option>
      <?php 
           foreach(glob(dirname(__FILE__) . '../../../uploads/*') as $filename){
           $filetypes = array("pdf", );
            $filetype = pathinfo($filename, PATHINFO_EXTENSION);
            if (in_array(strtolower($filetype), $filetypes)) {
                 $filename = basename($filename);
           echo "<option value='" . $filename . "'>".$filename."</option>";}
        }
    ?>

    </select> 

1 个答案:

答案 0 :(得分:0)

正如EhsanT所说,我只是错过了反斜杠

<select name="itinerarypath" type="text" id="itinerarypath">
          <option name="itinerarypath" type="text" id="itinerarypath" value="<?php echo $values['itinerarypath'] ?>" selected="selected"><?php echo $values['itinerarypath'] ?></option>
      <?php 
           foreach(glob(dirname(__FILE__) . '/../../../uploads/*') as $filename){
           $filetypes = array("pdf", );
            $filetype = pathinfo($filename, PATHINFO_EXTENSION);
            if (in_array(strtolower($filetype), $filetypes)) {
                 $filename = basename($filename);
           echo "<option value='" . $filename . "'>".$filename."</option>";}
        }
    ?>

    </select>