-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsubmit_feedback.php
34 lines (28 loc) · 939 Bytes
/
submit_feedback.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
// Check if form is submitted
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Get form data
$student_id = $_POST['student_id'];
$feedback = $_POST['feedback'];
// Connect to your database (adjust these parameters as needed)
$servername = "localhost";
$username = "root";
$password = "Nisa2001";
$dbname = "CGP";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Prepare SQL statement to insert data into the database
$sql = "INSERT INTO feedback (student_id, feedback) VALUES ('$student_id', '$feedback')";
if ($conn->query($sql) === TRUE) {
echo "Feedback submitted successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
// Close connection
$conn->close();
}
?>