i need help in the following code i am trying to create dynamic radio buttons from mysql db and want to insert into another table its not echoing data and not even inserting i am just beginner please help me out thanks in advance
<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
$db='tutorial';
$conn = mysqli_connect($dbhost,$dbuser,$dbpass,$db);
if(! $conn )
{
die('Could not connect: ' . error);
}
$sql = 'SELECT * FROM questions';
$result=mysqli_query($conn,$sql)
?> <form action ="for.php" method="post"> <table width=100% cellspacing="1"> <tr> <th scope="col"> </th> </tr> <th scope="col"> <?php while($rows=mysqli_fetch_array($result)) ?> <table width=100% cellspacing="1"> <tr> <th scope="col"> </th> <input type="radio" name="radio1_1"id="q_1"value="<?php echo $rows['$q1'];?>"> <label for="q1">:<?php echo $rows['$q1'];?></label> </tr> </table> <?php mysqli_close($conn);?> </th> </tr> <tr> <tr> <th scope="col"><input type="submit"name="submit"id="submit"value="submit"></th> <tr> <table> </form> <?php
$dbuser = 'root';
$dbpass = '';
$db='tutorial';
$dbhost='localhost';
$conn = mysqli_connect($dbhost,$dbuser,$dbpass,$db);
if(! $conn )
{
die('Could not connect: ' . error);
}
//$first_name = mysqli_real_escape_string($conn, $_POST['first_name']);
$option1=mysqli_real_escape_string($conn, $_POST['option1']);
$option2=mysqli_real_escape_string($conn, $_POST['option2']);
$option3=mysqli_real_escape_string($conn, $_POST['option3']);
$sql = "INSERT INTO feedback (option1,opion2,option3) VALUES ('$option1,$option2,$option3')";
mysqli_close($conn);
?>