如何在表单布局上以3/3格式排列复选框

时间:2010-05-15 13:36:58

标签: php html css

你好。任何人都可以告诉我如何安排从数据库中检索的菜肴标签的复选框列表,当它显示时,它不是在并排的顺序中我希望它以3×3显示格式。这是代码:

<div id="frmform">
    <form name="frmrestaurant" id="frmrestaurant" method="post" onsubmit="" enctype="multipart/form-data">
  <p class="msgsignup">Add Restaurant</p>
  <div id="iderror"></div>
  <div class="topinputs">
   <div> <label for="restaurant_name" class="name">Restaurant Name :</label><input type="text" name="restaurant_name" size="32" id="restaurant_name" value="<?php echo $row->restaurant_name; ?>" class="validate[required,custom[onlyLetter],length[0,100]] text-input" />  </div>


   </div>
   <div> <label for="website" class="name">Website :</label><input  size="32" type="text" name="website" id="website" value="<?php echo $row->website; ?>" class="validate[required,length[0,100]] text-input" />  </div>
   <div> <label for="budget" class="name">Budget :</label>
   <?php echo $this->lists['budget'];?>
   </div>
   <div> <label for="idcuisine" class="cuisine"  >Cuisine:</label>
   <?php echo $this->lists['cuisine']  ;?> 

   <div> <label for="idcategory" class="category">Category:</label>
   <?php echo $this->lists['category'];?>
   </div>

菜单和类别列表显示不正确。

感谢。

1 个答案:

答案 0 :(得分:2)

可以使用php正确的逻辑

完成
    <tr>
        <?php 
             while($ofetch=$db->fetchNextObject($query)) 
              { 
              $j++;
        ?>
                 <td width="33%">
                  <input type="checkbox" name="service[]" id="service" value="<?php echo $ofetch->service_id?>" /> some text
                 </td>
                 <?php if($j%3==0) { echo "</tr><tr>";}
                   }
                   ?>
   </tr>