得到一个我似乎无法弄清楚的简单问题。如果你打开php小提琴,结果部分如何进入最后一列没有其行数填充每一行?我已经将rowspan包含在其他列中,这些列需要rowspan,但它不适用于此列。
有人知道造成这种情况的原因吗?
http://phpfiddle.org/main/code/get-rps
完整的表格代码:
<table id='penaltytbl'>
<thead>
<tr>
<th class='questionth'>Question No.</th>
<th class='questionth'>Question</th>
<th class='incorrectanswerth'>Incorrect Answer</th>
<th class='answermarksth'>Marks per Answer</th>
<th class='totalmarksth'>Total Marks</th>
<th class='noofmarksth'>Marks Remaining</th>
</tr>
</thead>
<tbody>
<?php
foreach($ques_ans as $questionNo => $inc_ans)
{
$q_row_span = count($inc_ans);
$row_count = 0;
$inc_ans = array_values($inc_ans);
?>
<tr class="questiontd">
<td class="questionnumtd q<?php echo$questionNo?>_qnum" rowspan="<?php echo$q_row_span?>"><?php echo$questionNo?>
<input type="hidden" name="numQuestion" value="<?php echo$questionNo?>" />
<input type="hidden" name="q<?php echo$questionNo?>_ans_org" class="q<?php echo$questionNo?>_ans_org" value="<?php echo$searchMarks[array_search($questionNo, $searchQuestionNo)]?>">
<input type="hidden" name="q<?php echo$questionNo?>_ans" class="q<?php echo$questionNo?>_ans" value="<?php echo$searchMarks[array_search($questionNo, $searchQuestionNo)]?>">
</td>
<td class="questioncontenttd" rowspan="<?php echo$q_row_span?>"><?php echo$searchQuestionContent[array_search($questionNo, $searchQuestionNo)]?> </td>
<td class="answertd"><?php echo$inc_ans[$row_count];?>
<input type="hidden" id="hiddenincorrect" name="incorrect[]" value="<?php echo$inc_ans[$row_count];?>">
</td>
<td class="answermarkstd">
<input class="individualMarks q<?php echo$questionNo?>_mark" q_group="1" name="answerMarks[]" type="text" data-type="qmark" data-qnum="<?php echo$questionNo?>" onkeypress="return isNumberKey(event)" maxlength="3" value="0" />
</td>
<td class="totalmarkstd" rowspan="<?php echo$q_row_span?>"><?php echo$totalMarks[array_search($questionNo, $searchQuestionNo)]?></td>
<td class="noofmarkstd q<?php echo$questionNo?>_ans_text" q_group="1" rowspan="<?php$q_row_span?>"><?php echo"<strong>".$searchMarks[array_search($questionNo, $searchQuestionNo)]."</strong>"?></td>
</tr>
<?php
//remaining incorrect answers in separate row (if any) follows here
if($row_count < $q_row_span - 1)
{
for($i=($row_count + 1); $i<$q_row_span; $i++) { ?>
<tr>
<td class="answertd"><?php echo$inc_ans[$i];?>
<input type="hidden" id="hiddenincorrect" name="incorrect[]" value="<?php echo$inc_ans[$i];?>">
</td>
<td class="answermarkstd">
<input class="individualMarks q<?php echo$questionNo?>_mark" q_group="1" name="answerMarks[]" type="text" data-type="qmark" data-qnum="<?php echo$questionNo?>" onkeypress="return isNumberKey(event)" maxlength="3" value="0" />
</td>
</tr>
<?php
}
}
}
?>
</tbody>
</table>
答案 0 :(得分:0)
您在下面的一行中错过了echo
:
<td class="noofmarkstd q<?php echo $questionNo?>_ans_text" q_group="1" rowspan="<?php$q_row_span?>"><?php echo"<strong>".$searchMarks[array_search($questionNo, $searchQuestionNo)]."</strong>"?></td>
约105-107
请参阅fiddle
顺便说一句,php必须通知你错误。