当name属性在while循环中时,有什么方法可以获取它吗?我想调用单选按钮的name属性来插入数据库
if ($result = $conn - > query($query)) {
while ($row = $result - > fetch_row()) {
//$app_rows.append($row[1])
$app_rows = array($row[1]);
?>
< tr >
< td id = "app_name" > <? php foreach($app_rows as $values) {
echo $values; ?> < /td> < td > < input type = "radio"
name = "<?php echo $values; ?>"
id = "<?php echo $values. " - P0 "; ?>"
value = "P0" > < /td> < td > < input type = "radio"
name = "<?php echo $values; ?>"
id = "<?php echo $values. " - P1 "; ?>"
value = "P1" > < /td> < td > < input type = "radio"
name = "<?php echo $values; ?>"
id = "<?php echo $values. " - P2 "; ?>"
value = "P2" > < /td> < td > < input type = "radio"
name = "<?php echo $values; ?>"
id = "<?php echo $values. " - P3 "; ?>"
value = "P3" > < /td> < td > < input type = "radio"
name = "<?php echo $values; ?>"
id = "<?php echo $values. " - P4 "; ?>"
value = "P4" > < /td> <? php
} ?>
< /tr> <? php
}
$result - > close();
}
2条答案
按热度按时间eh57zj3b1#
wwodge7n2#
可以在属性名中使用数组,例如在代码中
然后在后端
愿它能帮助你