Append radio button
<p>How to append radio button using jquery or javascript to save into the databse?</p>

<p>I appended input types like text,textarea,checkbox,select with options.</p>

<p>My code is </p>

<pre><code> &lt;!DOCTYPE html&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
&lt;title&gt;
apnd
&lt;/title&gt;
&lt;script src="jquery.min.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;script&gt;
$(document).ready(function(){
var htmldata='&lt;div&gt;Name&lt;input type="text" name="cname[]"&gt;Mobile Number&lt;input type="text"name="mob[]"&gt;Gender&lt;input type="radio" name="gender[]" value="M"&gt;Male&lt;input type="radio" name="gender[]" value="F"&gt;FemaleAddress&lt;textarea name="address[]"&gt;&lt;/textarea&gt;&lt;input type="button" class="remove_field" value="remove"&gt;&lt;/div&gt;';
$('.add_field').click(function(){
$('.wrapper').append(htmldata); 
});
$('.wrapper').on('click','.remove_field',function(){
$(this).parent('div').remove(); 
});
});
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div class="container"&gt;
&lt;form method="post" action=""&gt;
&lt;div class="wrapper"&gt;
&lt;div&gt;
    Name&lt;input type="text" name="cname[]"&gt;
    Mobile Number&lt;input type="text" name="mob[]"&gt;
    Gender&lt;input type="radio" name="gender[]" value="M"&gt;Male
          &lt;input type="radio" name="gender[]" value="F"&gt;Female
    Address&lt;textarea name="address[]"&gt;&lt;/textarea&gt;
    &lt;input type="button" class="add_field" value="Add"&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;input type="submit" name="sub" value="Save"&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>using php I want to save the values to database.</p>

<pre><code>$name=sc_sql_injection($_POST['cname']);
        $mobile=sc_sql_injection($_POST['mob']);
        $gender=sc_sql_injection($_POST['gender']);
        $address=sc_sql_injection($_POST['address']);
        $count=count($_POST['cname']);
        for($i=0;$i&lt;$count;$i++)
        {
            $sql="insert into t2(name,mobile,gender,address) values('$name[$i]','$mobile[$i]','$gender[$i]','$address[$i]')";
            sc_exec_sql($sql,$con);
   }
</code></pre>

<p><strong>Update</strong>
<a href="https://i.stack.imgur.com/Gm0Ld.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Gm0Ld.png" alt="enter image description here"></a></p>