i have table in mysql data with name of questions and it has two columns. Questionid-pk, Question-Text
i have just 5 questions in database and i am retrieving 5 questions from database and generating dynamic radio buttons. so i want when i click submit button am able to get values of each radio button. here is my code
<form id="sny" name="sny" action="" method="post" enctype="multipart/form-data">
<?php
if (!(isset($_POST['submit']))) {
include("connect-db.php");
$query_salutation_type="SELECT * FROM questions";
echo $query_salutation_type;
$select_salutation_type=mysqli_query($connection, $query_salutation_type);
while($row1 = mysqli_fetch_array($select_salutation_type))
{
$name=$row1[0];
echo $name;
echo "<input type='radio' id='$name' name='$name' value='Yes' />Yes";
echo "<input type='radio' id='$name' name='$name' value='Yes' />Yes";
echo'<br />';
}
}
?>
<button type="submit" name="submit" id="submit"> Click now....!!!</button>
</form>
here am trying to get $post value after submit button click
<?php
if(isset($_POST['submit']) )
{
echo $_POST['1'];
echo $_POST['2'];
echo $_POST['3'];
echo $_POST['4'];
echo $_POST['5'];
}
?>
`
but i am receiving error
Notice: Undefined offset: 1 in C:\xampp\htdocs\hba\rnd.php on line
i hope you understand what am trying to do. kindly check my code thanks