<;选择>;不填充,按钮与<;选择>;


<select> not populating, buttons inline with <select>

我正在使用html、php和bootstrap来创建一些列表和按钮。我的第一个问题是,我已经编写了一个脚本来填充"选择"下拉列表。它应该转到"sounds/"目录,并用.wav文件填充自己。"选择"正确显示,只是没有填充列表。我在目录中确实有.wav文件,并且我授予了目录本身的完全权限。事实并非如此。

我的另一个问题是,如何将一个按钮和"选择"下拉框对齐。我不想坐下一班。

<!--CALL TAB-->
<div id="call">
  <div class="container">
  <div class="hero-unit">
      <h5>Call Functions -</h5>
      <h6>Test Paragraph</h6>
      <br>
      <h6> Select a Sound One -</h6>
      <div class="row">
        <div class="span2">
          <select id="sound1">
            <?php 
              foreach(glob('sounds/*.wav') as $filename){
              $rest = substr($filename, 7);    
              echo "<option>".$rest."</option>";
              }
            ?>
          </select>
        </div>
      </div>
      <br>
      <h6> Select a Sound Two -</h6>
      <div class="row">
        <div class="span2">
          <select id="sound2"> 
            <?php 
              foreach(glob('sounds/*.wav') as $filename){
              $rest = substr($filename, 7);    
              echo "<option>".$rest."</option>";
              }
            ?>
          </select>
        </div>
      </div>
      <br>
      <h6>Volume - </h6>
      <div id="slider-range-max">
      </div>
    <div class="row">
      <div class="span6">
        <br>
        <p><a class="btn btn-large btn-primary" href="index.html">Play <i class="icon-   play"></i></a> <a class="btn btn-large btn-danger" href="index.html">Pause <i class="icon-pause"></i></a>
      </div>
    </div>
  </div>
  <hr>
    <footer>
      <p>&copy; FOOTER</p>
    </footer>
  </div>
</div>

获取选择旁边的按钮很简单。如果没有将selectbutton设置为block元素的样式,则它们应该并排显示(内联块)。如果下面的HTML对您不起作用(按钮不是下一个可供选择的按钮),请尝试将float: left;添加到selectbutton中。

对于您的glob(),您确定路径正确吗?与sounds文件夹相比,执行此操作的PHP文件在哪里?你的目录结构是什么?

http://jsfiddle.net/3JQeZ/

<div class="row">
    <div class="span2">
        <select id="sound1">
            <option>1 option</option>
            <option>2</option>
            <option>3</option>
        </select>
        <button>Button</button>
    </div>
</div>