I have dynamically created radio buttons.

<input type="radio" name="qtn-$i" value="yes">

Now how to get the values of these buttons using post method?

Are you using PHP? 'Cos there is no way our going to get the radio buttons appear on the screen without the echo statement. You code above is going to go into an infinite loop, provided of course you put in a loop statement in the first place.

Also the way you have created the radio buttons with different names, will be in such a way that you can select all the radio buttons at a time.

Enough of my criticism, coming down to the actual code part.

<form method="post">
echo $_POST['qtn'];
for ($i=1;$i<=4;$i++){
	echo "<input type='radio' name='qtn' value='$i'>";
<input type="submit">

The above code is a simple way you can get the values of the radio buttons using a POST method. The name of the radio buttons need to be the same but the value will change.

Please do let me know if you need anything else.

Be a part of the DaniWeb community

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