html code:

    <tr> <td id="qn1" name="qn1">1</td> <td>Presentation of course overview and relevant references</td> <td> <select class="form-control" name="select"> <option value="very good">Very Good</option> <option value="good">Good</option> <option value="average">Average</option> <option value="poor">Poor</option> <option value="very poor">Very Poor</option> </select> </td> </tr>



php code:
<?php 
$servername = "localhost";
$username = "root";
$password ="";
$dbname = "surveyproject";

//establish connection
$connection = mysqli_connect($servername , $username,$password ,$dbname);

//check for connection errors
if ($connection->connect_error) {
die("Connection failed: " . $connection->connect_error);
}
echo "connected succesfully";



//inserting answers into db
if (isset($_POST['submit'])) {
if(isset($_POST['select']) && isset($_POST['qn1'])){
$select = $_POST['select'];
$qn = $_POST['qn1'];
$query="INSERT INTO surveyanswers (quest_id,answer) VALUES   
('$select','$qn')";
mysqli_query($query);
}
echo "<script>alert('succesfully submitted answers , thankyou'</script>";
}
mysqli_close($connection);

?>

I wonder what you've done to work this issue. Here you make a post, title and dumped code. That's pretty short and may not tell us if the connection or the data didn't make it to the server.

Anyhow. Take your $query from line 28 and manually try it with your SQL command line. Does that work?

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.