0
 <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?

ravz
  • 1
  • 2
  • Here is the answer for radio buttons https://stackoverflow.com/questions/5665915/how-to-check-a-radio-button-with-jquery – Elzo Valugi Sep 18 '16 at 21:48

1 Answers1

1

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' : '');?>>
Naresh Kumar P
  • 4,127
  • 2
  • 16
  • 33