我正在开发一个应用程序/表单,它有一个表,该表通过带有单选按钮的 foreach 循环从数据库中填充,一个表示是,一个表示否,还有一个下拉列表。我需要它以便在选择“是”单选按钮时禁用 dd,在选择“否”时启用它。我让它工作,但它只适用于顶行,而且我无法预选所有的是单选按钮。所以简而言之,我无法弄清楚如何预选所有 yes rd btns,这反过来会禁用 dd。任何帮助都会很棒。谢谢。
<?php
//Foreach loop iterates through each column of $getallrows function
foreach($allRows as $rowID => $rowInfo){ ?>
<tr>
<td><?php echo $rowInfo['fpID'];?></td>
<td><?php echo $rowInfo['shortTitle'];?></td>
<td><?php echo $rowInfo['PI'];?></td>
<td><?php echo $rowInfo['Department'];?></td>
<td><?php echo $rowInfo['Division'];?></td>
<td><?php echo $rowInfo['sponsorName'];?></td>
<td><?php echo $rowInfo['Date_Project_Start']->format('Y-m-d');?></td>
<td><?php echo $rowInfo['Date_Project_End']->format('Y-m-d');?></td>
<td><?php echo $rowInfo['fundingType'];?></td>
//Radio buttons
<td>Yes<input type="radio" name="rdGrant" value="Yes" id="rdYes" onclick="disable()" checked="checked"/><br />
No<input type="radio" name="rdGrant" value="No" id="rdNo" onclick="enable()"/></td>
<form action="classes/functions.class.php" method="POST">
<input type="hidden" name="id" value="<?php echo $fpID; ?>"/>
<td>
//Drop down
<div class="dropdown">
<button class="btn btn-secondary btn-sm dropdown-toggle" type="button" name="ddgrantGroup" id="ddgrantType" data-toggle="dropdown">Select Proper Funding Type
精慕HU