同一页面上的两个下拉菜单和复选框无效

时间:2011-01-12 08:31:59

标签: php

我必须根据if条件使用相同的复选框和下拉菜单,---->

<div id="5"  <? if($long_term_rental!=1) {?> style="display:none" <? } else {?>style="display:block" <? } ?>> 
                    <table width="85%" >
                    <tr class="td3">
<td>City  </td>
                    <td><select style="width:100px;" name="citylong" size="1" class="textfeild1" id="citylong">
                     <option  <? if($citylong=="None")echo "selected='selected'";?>>None</option>
                      <option <? if($citylong=="Palm Springs")echo "selected='selected'";?>>Palm Springs</option>
                      <option <? if($citylong=="Cathedral City")echo "selected='selected'";?>>Cathedral City</option>
                      <option <? if($citylong=="Rancho Mirage")echo "selected='selected'";?>>Rancho Mirage</option>
                      <option <? if($citylong=="Palm Desert")echo "selected='selected'";?>>Palm Desert</option>
                      <option <? if($citylong=="La Quinta")echo "selected='selected'";?>>La Quinta</option>
                      <option <? if($citylong=="Indian Wells")echo "selected='selected'";?>>Indian Wells</option>
                    </select></td></tr>

                  <tr class="td2">
                  <td align="left">Upper/Lower/Town House/Single Story</td>
                    <td align="left"><select style="width:100px;" name="floorlong" size="1" class="textfeild1" id="floorlong">
                      <option  <? if($floorlong=="None")echo "selected='selected'";?>>None</option>
                      <option <? if($floorlong=="Upper")echo "selected='selected'";?>>Upper</option>
                      <option <? if($floorlong=="Lower")echo "selected='selected'";?>>Lower</option>
                      <option <? if($floorlong=="TH")echo "selected='selected'";?>>TH</option>
                     <option <? if($floorlong=="Single Story")echo "selected='selected'";?>>Single Story</option>
                      </select></td>
                          </tr>
                           <tr class="td2">
                    <td>&nbsp;</td>
                    <td >Pets Allowed : </td>
                    <td ><input class="textfeild1" type="checkbox" name="petslong" id="petslong" value="Pets" <? if($petslong==1) echo "checked='checked'";?>/></td>
                    <td>Pool : </td>
                    <td><input class="textfeild1" type="checkbox" name="poollong" id="poollong" value="Pool" <? if($poollong==1) echo "checked='checked'";?>/></td>
                    <td align="right">&nbsp;</td>
                  </tr>
                       <tr class="td2">
                    <td>&nbsp;</td>
                    <td>Jacuzzi  : </td>
                    <td><input class="textfeild1" type="checkbox" name="jacuzzilong" id="jacuzzilong" value="Jacuzzi" <? if($jacuzzilong==1) echo "checked='checked'";?>/></td></div>

And on condition false display the below code---->

<div id="mylng"  <? if($long_term_rental!=1) {?> style="display:block" <? } else {?>style="display:none" <? } ?>> 
                    <table width="100%" >
                    <tr class="td3">
                    <td>&nbsp;</td>
                     <td>City  </td>
                    <td><select style="width:100px;" name="city" size="1" class="textfeild1" id="city">
                     <option  <? if($city=="None")echo "selected='selected'";?>>None</option>
                      <option <? if($city=="Palm Springs")echo "selected='selected'";?>>Palm Springs</option>
                      <option <? if($city=="Cathedral City")echo "selected='selected'";?>>Cathedral City</option>
                      <option <? if($city=="Rancho Mirage")echo "selected='selected'";?>>Rancho Mirage</option>
                      <option <? if($city=="Palm Desert")echo "selected='selected'";?>>Palm Desert</option>
                      <option <? if($city=="La Quinta")echo "selected='selected'";?>>La Quinta</option>
                      <option <? if($city=="Indian Wells")echo "selected='selected'";?>>Indian Wells</option>
                    </select></td>
                    <td align="right" style="width: 223px;">Upper/Lower/Town House/Single Story</td>
                    <td align="left"><select style="width:100px;" name="floor" size="1" class="textfeild1" id="floor">
                     <option  <? if($floor=="None")echo "selected='selected'";?>>None</option>
                      <option <? if($floor=="Upper")echo "selected='selected'";?>>Upper</option>
                      <option <? if($floor=="Lower")echo "selected='selected'";?>>Lower</option>
                      <option <? if($floor=="TH")echo "selected='selected'";?>>TH</option>
                      <option <? if($floor=="Single Story")echo "selected='selected'";?>>Single Story</option>
                      </select></td></tr>

                      <tr class="td3">
                    <td>&nbsp;</td>
                    <td >Pets Allowed : </td>
                    <td ><input class="textfeild1" type="checkbox" name="pets" id="checkbox9" value="Pets" <? if($pets==1) echo "checked='checked'";?>/></td>
                    <td>Pool : </td>
                    <td><input class="textfeild1" type="checkbox" name="pool" id="checkbox8" value="Pool" <? if($pool==1) echo "checked='checked'";?>/></td>
                    <td align="right">&nbsp;</td>
                  </tr>
                       <tr class="td3">
                    <td>&nbsp;</td>
                    <td>Jacuzzi  : </td>
                    <td><input class="textfeild1" type="checkbox" name="jacuzzi" id="checkbox6" value="Jacuzzi" <? if($jacuzzi==1) echo "checked='checked'";?>/></td>
                     <td>&nbsp;</td>
                     <td>&nbsp;</td>
                    </tr> 
                      </table></div>

<div id="5"下的代码并非工作且<div id="mylng"下的相同代码完全正常工作

请帮忙

1 个答案:

答案 0 :(得分:0)

起初你没有关闭你的 / TR
/表
在......的最后 div id = 5
请将带有您的表单标签的代码发送给我们,也许您的错误就是HTML