I have a problem:
<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="text" class="form-control" id="<?= $kriteria[$j] . $kriteria[$i] ?>" name="<?= $j. $i ?>" value=""></td>
<?php endfor; ?>
</tr>
<?php endfor; ?>
</tbody>
</table>
This is the result
I want the blue side value is automatically fill when I input value from the red side like in image above Before I write the question, I tried to make autofill with jQuery like this
<script type="text/javascript">
$(document).ready(function () {
$("#SI").keyup(function () {
var value = $(this).val();
$("#IS").val(1/value);
});
});
</script>
but it's doesn't work

off$("#SI")and$("IS")? Ids must be unique, at the very least these are in a for loop, but they're not in your code.$kriteria[$key] = $val['nama'];should throw a warning about undefined index "nama" since$valwill be a string, not an array. You defined$data['kriteria']as an flat indexed array and not a multidimensional associative array 3 lines above that code.