提交多个选项的细化栏

时间:2014-04-22 15:41:34

标签: php html mysql search filter

我正在尝试创建一个在表单中提交了多个过滤器选项的细化栏。目前我的表单只提交了一个选项,有人可以告诉我我的代码中缺少什么吗?

  <form action="" method="post">

  <div id="box">
 <p>Occasion:</p>

    <?php
  $rs=mysql_query('select DISTINCT occasion from cakes');
    ?>
    <select name="occasion"onchange='location=this.options[this.selectedIndex].value;'>
    <?php
    $path="filter1.php?search=";
    while($record=mysql_fetch_assoc($rs)){
        ?>
        <option value="<?php echo $path.$record['occasion']; ?>"><?php echo $record['occasion']; ?></option>

  <?php
  }

    ?>
    </select>
</div>

 <div id="box">
    <p>Styles:</p>
    <?php
 $rs=mysql_query('select DISTINCT style from cakes');
    ?>
    <select name="style" onchange='location=this.options[this.selectedIndex].value;'>

    <?php
    $path="filter1.php?choice=";
    while($record=mysql_fetch_assoc($rs)){
        ?>
        <p><option value="<?php echo $path.$record['style']; ?>"><?php echo $record['style']; ?></option></p>

    <?php
    }
    ?>
    </select>
</div>

    <div id="box">
    <p>Colours:</p>
    <?php
    $rs=mysql_query('select DISTINCT colour from cakes');
    ?>
    <select name="colour"  onchange='location=this.options[this.selectedIndex].value;'>
    <?php
        $path="filter1.php?choice=";
    while($record=mysql_fetch_assoc($rs)){
        ?>
        <p><option value="<?php echo $path.$record['colour']; ?>"><?php echo $record['colour']; ?></option></p>
  <?php
  }
  ?>
        </select>

</div>

  <div id="box">
          <p>Filling:</p>
    <?php
  $rs=mysql_query('select DISTINCT filling from cakes');
    ?>
    <select name="filling"

     onchange='location=this.options[this.selectedIndex].value;' >



    <?php
        $path="filter1.php?choice=";
    while($record=mysql_fetch_assoc($rs)){
        ?>
        <p><option value="<?php echo $path.$record['filling']; ?>"><?php echo $record['filling']; ?></option></p>

  <?php
  }
  ?>
  </select>
  <p>

</div>
<div id="box">

    <p>Topping:</p>
    <?php
  $rs=mysql_query('select DISTINCT topping from cakes');
    ?>
    <select name="topping"

     onchange='location=this.options[this.selectedIndex].value;' >



    <?php
        $path="filter1.php?choice=";
    while($record=mysql_fetch_assoc($rs)){
        ?>
        <p><option value="<?php echo $path.$record['topping']; ?>"><?php echo $record['topping']; ?></option></p>

 <?php
  }
    ?>
    </select>
  <p>

</div>
 </form>

0 个答案:

没有答案