0

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);

?>

2
Contributors
1
Reply
13
Views
1 Year
Discussion Span
Last Post by rproffitt
1

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?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.