Although I’m not an expert in the field but I’ve managed to write a script for you that will do the work, Hope you will find it useful.
<!DOCTYPE html>
<html>
<head>
<title>Poll with Comment</title>
</head>
<body>
<h2> Basic Form </h2>
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST' &&
isset($_POST['SbtQues']) && !empty($_POST['Question'])
// Remove the '//' from the line below to make Comments Compulsory.
// && !empty($_POST['comments'])
){
$host = 'localhost'; // Change localhost according to your needs.
$user = 'abc'; // Change abc to your Database username.
$pass = 'xyz'; // Change xyz to your Database username name's passowrd.
$db = 'database'; // Change database to a database you want to store information.
$conn = @mysqli_connect($host, $user, $pass, $db);
if(!$conn) { die("Connection Failed"); }
$question = $_POST['Question'];
$comments = $_POST['comments'];
$table = 'question'; // Change the word question to a table in which you want to save the information.
$query = "INSERT INTO
{$table}
VALUES(
'{$question}',
'{$comments}'
)";
$results = mysqli_query($conn, $query);
if (!$results){ die("Cant Insert the Record"); }
else { echo "Thank You! Your Answer is Submitted."; }
}
else
{
?>
<p> Your Question Here </p>
<form method="post" action="">
<p>
<input type="radio" name="Question" value="Value1">Value1
</p>
<p>
<input type="radio" name="Question" value="Value2">Value2
</p>
<p>
<input type="radio" name="Question" value="Value3">Value3
</p>
<p>
<input type="radio" name="Question" value="Value4">Value4
</p>
<p>
<input type="radio" name="Question" value="Value5">Value5
</p>
<p>
<label for="comments">Insert Your Comments Here (Optional)</label> <br />
<textarea name="comments" id="comments" rows="4" cols="50"></textarea>
</p>
<p><input type="submit" name="SbtQues" value="Submit Your Answer"></p>
</form>
<?php
}
?>
</body>
</html>