我想将输入值保存到2D数组中。
<table>
<?php
$kriteria = array('IP', 'SE', 'PE', 'BE');
?>
<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>
我尝试了POST
方法,但是没有用。
我想使用输入中的值在另一页中进行计数。
我想使用输入中的值在另一页中进行计数。
public function page1()
{
$kriteria = json_encode(array('IP', 'SE', 'PE', 'BE'));
$temp = sys_get_temp_dir() . '/tmp_file_123';
file_put_contents($temp, $kriteria);
}
public function page2()
{
$temp = sys_get_temp_dir() . '/tmp_file_123';
$kriteria = file_get_contents($temp);
}