【发布时间】:2020-03-10 08:12:38
【问题描述】:
我在带有表单的页面中传递一个单选按钮的值,我想在另一个 php 文件中获取所选选项的值,但我无法获取该值。
首页:
<form class="itemSelection" action="../php/itemSelection1Save.php"><br><br>
<h1>Recommended Item(s)</h1>
<table class="itemTableRecom">
<thead>
<tr>
<th>Selected Item Type</th>
<th>Recommended Item Type</th>
</tr>
</thead>
<tbody>
<?php
foreach ($_SESSION['itemsInfo'] as $row) {
?>
<tr>
<td><input type="radio" name="selectedItem" id="selectedItem" required="" value="<?php echo $row[0] ?>"></td>
<td><?php
echo row[0]</td>
</tr>
<?php
}
?>
</tbody>
</table><br>
<input type="submit" value="Next"/>
</form>
第二个文件:
$_SESSION['selectedItem1'] = filter_input(INPUT_POST, 'selectedItem');
filter_input(INPUT_POST, 'selectedItem')
什么都不返回
【问题讨论】:
-
你错过了 $。
echo row[0](开始)