I hope that is what you looking:
(我希望那是你的期待:)
<table>
<?php
$data['kriteria'] = array('IPK', 'SEMESTER', 'PENGHASILAN', 'BEASISWA LAIN');
$kriteria = array();
foreach ($data['kriteria'] as $key => $val) {
$kriteria[$key] = $val['nama'];
}
?>
<thead>
<tr>
<th>Kriteria</th>
<?php
foreach ($kriteria as $val) {
echo '<th>' . $val . '</th>';
}
?>
</tr>
</thead>
<tbody>
<?php $n = count($kriteria); ?>
<?php for ($i = 0; $i < $n; $i++): ?>
<tr>
<th><?= $kriteria[$i] ?></th>
<?php for ($j = 0; $j < $n; $j++): ?>
<td><input type="number" min="1" max="9" class="form-control" id="<?= $kriteria[$j] . $kriteria[$i] ?>" name="<?= $j. $i ?>"></td>
<?php endfor; ?>
</tr>
<?php endfor; ?>
</tbody>
</table>
Result:
(结果:)
<table>
<thead>
<tr>
<th>Kriteria</th>
<th>I</th><th>S</th><th>P</th><th>B</th> </tr>
</thead>
<tbody>
<tr>
<th>I</th>
<td><input type="number" min="1" max="9" class="form-control" id="II" name="00"></td>
<td><input type="number" min="1" max="9" class="form-control" id="SI" name="10"></td>
<td><input type="number" min="1" max="9" class="form-control" id="PI" name="20"></td>
<td><input type="number" min="1" max="9" class="form-control" id="BI" name="30"></td>
</tr>
<tr>
<th>S</th>
<td><input type="number" min="1" max="9" class="form-control" id="IS" name="01"></td>
<td><input type="number" min="1" max="9" class="form-control" id="SS" name="11"></td>
<td><input type="number" min="1" max="9" class="form-control" id="PS" name="21"></td>
<td><input type="number" min="1" max="9" class="form-control" id="BS" name="31"></td>
</tr>
<tr>
<th>P</th>
<td><input type="number" min="1" max="9" class="form-control" id="IP" name="02"></td>
<td><input type="number" min="1" max="9" class="form-control" id="SP" name="12"></td>
<td><input type="number" min="1" max="9" class="form-control" id="PP" name="22"></td>
<td><input type="number" min="1" max="9" class="form-control" id="BP" name="32"></td>
</tr>
<tr>
<th>B</th>
<td><input type="number" min="1" max="9" class="form-control" id="IB" name="03"></td>
<td><input type="number" min="1" max="9" class="form-control" id="SB" name="13"></td>
<td><input type="number" min="1" max="9" class="form-control" id="PB" name="23"></td>
<td><input type="number" min="1" max="9" class="form-control" id="BB" name="33"></td>
</tr>
</tbody>
</table>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…