Hi,
I want to create a group of radio button(2 buttons on a group) by dynamically with different names.After submitting the form I want to retrieve it on PHP.
I can create the radio buttons dynamically.But I could not retrieve the values on PHP.
There is a problem with radio button name.
The code I used is listing below.By clicking Add more button the button is displaying..By clicking submit button the form is submitted..

main.html

<script language="javascript">
function changeIt()
{
//var i = 1;
my_div.innerHTML = my_div.innerHTML +"<br>Skills <input type='text' name='mytext[]' value='mytext'>";
my_div.innerHTML = my_div.innerHTML +" Good<input type='radio' id='my' value='mytext' value='1' name='radio[]'>";
my_div.innerHTML = my_div.innerHTML +"LOw<input type='radio' id='my' value='2' name='radio[]'>";


//var el = document.getElementById('my');
//el.name = 'level';
}
</script>

and write this in the body.........

<form name="form" action="homep.php" method="">

<div id="my_div">
  
</div>
<input type="button" value="ADD More" onClick="changeIt()">

<input type="submit" name="Submit" value="Submit">

</form>

homep.php

<?php 

$t= $_REQUEST['mytext'];
print_r($t);
$p=$_REQUEST['radio'];
print_r($p);

?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.