使用.checked()函数时,只检测到第一个单选按钮。 休息不被视为[重复]

This question already has an answer here:

 <form action="" method="post">
 <div class="second" style="margin-top:3px;margin-left:10px;font-size:100%">Add to</div>
 <?php $new2=array();$new2=getlist();
 foreach($new2 as $value)
 { 
 echo'<input type="radio" id="qwerty" name="qwerty" value="'.$value.'" onclick="theLast()"  />';

 echo"$value";echo"<br>";}?>
<hr>
<button type="button" id="add2" class="new" onclick="theFinal()" >Create new list</button>
</form>
</div>

only first button is checked if i use

if (document.getElementById('qwerty').checked) {

how to check if other radio buttons are checked?

</div>

You have to check the value stored in the database and provide the condition over to this ternary operator.

<input type="checkbox" name="tag_1" id="tag_1" value="yes" <?php echo ($dbvalue['tag_1']==1 ? 'checked' : '');?>>