php循环输出表格错位的问题
<div class="wpzj">
<h1 class="neiyi">外聘专家</h1>
<ul class="bkm">
<li class="hong">姓 名</li>
<li>职称</li>
<li>价格</li>
<li class="hong">姓 名</li>
<li>职称</li>
<li>价格</li>
<li class="hong">姓 名</li>
<li>职称</li>
<li class="bkym">价格</li>
</ul>
<ul class="bkm">
<li class="hong">刘 红</li>
<li></li>
<li></li>
<li class="hong">祝 蓉</li>
<li></li>
<li></li>
<li class="hong">吴金荣</li>
<li></li>
<li class="bkym"></li>
</ul>
<ul class="bkm">
<li class="hong">刘燕池</li>
<li></li>
<li></li>
<li class="hong"></li>
<li></li>
<li></li>
<li class="hong"></li>
<li></li>
<li class="bkym"></li>
</ul>
</div>
<?php
if ( isset($arrayServiceType) && is_array($arrayServiceType) ) {
$strWaiDoctor = "";
for ($i=0; $i< count($arrayServiceType); $i++) {
if($i%4==0){
$strWaiDoctor.="<ul class="bkm">";
}
if ( $arrayServiceType[$i]['type'] == '1' ) {
if(($i+1) % 4 == 0) {
$strWaiDoctor.="<li class="hong"><a href="showorderinginfo.php?cardnumber=".$_REQUEST['cardnumber']."&organid=".$_REQUEST['organid']."&orderingid=".$_REQUEST['orderingid']."&serviceid=".$arrayServiceType[$i]['服务编号']."&doctorid=".$arrayServiceType[$i]['doctorid']."&showdoctorinfo=display">".$arrayServiceType[$i]['doctorname']."</a> </li><li></li><li style="border-right:none;">".$arrayServiceType[$i]['金额']."元</li>";
}else{
$strWaiDoctor.="<li class="hong"><a href="showorderinginfo.php?cardnumber=".$_REQUEST['cardnumber']."&organid=".$_REQUEST['organid']."&orderingid=".$_REQUEST['orderingid']."&serviceid=".$arrayServiceType[$i]['服务编号']."&doctorid=".$arrayServiceType[$i]['doctorid']."&showdoctorinfo=display">".$arrayServiceType[$i]['doctorname']."</a> </li><li></li><li>".$arrayServiceType[$i]['金额']."元</li>";
}
}
if(($i+1) % 4 == 0) {
//if(($i+1) % 3 == 0) {
$strWaiDoctor.= "</ul>";
}
}
echo $strWaiDoctor;
}
?>
<?php
if ( isset($arrayServiceType) && is_array($arrayServiceType) ) {
$strWaiDoctor = "";
for ($i=0; $i< count($arrayServiceType); $i++) {
if($i%4==0){
$strWaiDoctor.="<ul class="bkm">";
}
if ( $arrayServiceType[$i]['type'] == '1' ) {
if(($i+1) % 4 == 0) {
$strWaiDoctor.="<li class="hong"> <a href="showorderinginfo.php?cardnumber=".$_REQUEST['cardnumber']."&organid=".$_REQUEST['organid']."&orderingid=".$_REQUEST['orderingid']."&serviceid=".$arrayServiceType[$i]['服务编号']."&doctorid=".$arrayServiceType[$i]['doctorid']."&showdoctorinfo=display">".$arrayServiceType[$i]['doctorname']."</a> </li><li> </li><li style="border-right:none;"> ".$arrayServiceType[$i]['金额']."元</li>";
}else{
$strWaiDoctor.="<li class="hong"> <a href="showorderinginfo.php?cardnumber=".$_REQUEST['cardnumber']."&organid=".$_REQUEST['organid']."&orderingid=".$_REQUEST['orderingid']."&serviceid=".$arrayServiceType[$i]['服务编号']."&doctorid=".$arrayServiceType[$i]['doctorid']."&showdoctorinfo=display">".$arrayServiceType[$i]['doctorname']."</a> </li> <li> </li><li> ".$arrayServiceType[$i]['金额']."元</li>";
}
}
if(($i+1) % 4 == 0) {
// if(($i+1) % 3 == 0) {
$strWaiDoctor.= "</ul>";
}
}
echo $strWaiDoctor;
}
?>