gpt4 book ai didi

php - 无法在单选按钮之间切换

转载 作者:行者123 更新时间:2023-11-30 22:23:10 25 4
gpt4 key购买 nike

我想根据 mysql 表中的数据并使用 php 显示带有单选按钮的列,但我无法在单选按钮之间切换。下面是代码。

                while($rows = $stmt->fetch(PDO::FETCH_ASSOC)){ ?>
<tr>
<td border="0" type="hidden" style="display:none;"><input type="hidden" name="hidden" value=<?php echo $rows['member_id']; ?></td>
<td class="center"><?php echo $rows['username']; ?></td>
<td class="center"><?php echo $rows['email']; ?></td>

<?PHP if($_SESSION['user_group'] == 63){
echo '<td class="center"><input type="radio" id='?><?php echo $rows['username']; 'name="gp" value="system admin"' ?>
<?php echo ($rows['permission']== 31 )?'checked':'' ?>'</input> </td>' <?PHP ;
echo '<td class="center"><input type="radio" id='?><?php echo $rows['username']; 'name="gp" value="admin"' ?>
<?php echo($rows['permission']== 15 )?'checked':'' ?> '</input> </td>' <?PHP ;
echo '<td class="center"><input type="radio" id='?><?php echo $rows['username'];'name="gp" value="user"'
?><?php echo ($rows['permission']== 1 )?'checked':'' ?> '</input> </td>' <?PHP ; }

elseif($_SESSION['user_group'] == 31){
echo '<td class="center"><input type="radio" id='?><?php echo $rows['username']; 'name="gp" value="admin"' ?>
<?php echo($rows['permission']== 15 )?'checked':'' ?> '</input> </td>' <?PHP ;
echo '<td class="center"><input type="radio" id='?><?php echo $rows['username'];'name="gp" value="user"'
?><?php echo ($rows['permission']== 1 )?'checked':'' ?> '</input> </td>' <?PHP ; }
elseif($_SESSION['user_group'] == 15){
echo '<td class="center"><input type="radio" id='?><?php echo $rows['username'];'name="gp" value="user"'
?><?php echo ($rows['permission']== 1 )?'checked':'' ?> '</input> </td>' <?PHP ; }?>


<td class="center"><button name="update" type="update">submit</button></td>
</tr>
<?php
}

看起来代码中有错误。任何帮助。当前的翻译如下。

enter image description here

我想在单选按钮之间切换。

最佳答案

能够弄清楚。从 html 列行的开头删除了 echo 命令。代码如下所示。

while($rows = $stmt->fetch(PDO::FETCH_ASSOC)){ ?>
<tr>
<td border="0" type="hidden" style="display:none;"><input type="hidden" name="hidden" value=<?php echo $rows['member_id']; ?></td>
<td class="center"><?php echo $rows['username']; ?></td>
<td class="center"><?php echo $rows['email']; ?></td>

<?PHP if($_SESSION['user_group'] == 63){ ?>
<td class="center"><input type='radio' id=<?php echo $rows['username']; ?> name="gp" value="system admin"
<?php echo ($rows['permission']== 31 )?'checked':'' ?>></input> </td>
<td class="center"><input type='radio' id=<?php echo $rows['username']; ?> name="gp" value="admin"
<?php echo ($rows['permission']== 15 )?'checked':'' ?> ></input> </td>
<td class="center"><input type='radio' id=<?php echo $rows['username']; ?> name="gp" value="user"
<?php echo ($rows['permission']== 1 )?'checked':'' ?> ></input> </td> <?PHP }

elseif($_SESSION['user_group'] == 31){ ?>
<td class="center"><input type='radio' id=<?php echo $rows['username']; ?> name="gp" value="admin"
<?php echo ($rows['permission']== 15 )?'checked':'' ?> ></input> </td>
<td class="center"><input type='radio' id=<?php echo $rows['username']; ?> name="gp" value="user"
<?php echo ($rows['permission']== 1 )?'checked':'' ?> ></input> </td> <?PHP }
elseif($_SESSION['user_group'] == 15){ ?>
<td class="center"><input type='radio' id=<?php echo $rows['username']; ?> name="gp" value="user"
<?php echo ($rows['permission']== 1 )?'checked':'' ?> ></input> </td><?PHP }?>

这工作得很好。

关于php - 无法在单选按钮之间切换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36119917/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com