-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsubmit.php
More file actions
30 lines (24 loc) · 787 Bytes
/
submit.php
File metadata and controls
30 lines (24 loc) · 787 Bytes
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
<?php
/*create a new entry in the table*/
$con = mysqli_connect("127.0.0.1", "wilmapco", "testing", "testDB");
if ($stmt = mysqli_prepare($con, "INSERT INTO CommentTable2 (name, email, comment, feature, vote) VALUES (?, ?, ?, ?, ?)")) {
mysqli_stmt_bind_param($stmt, "sssss", $name, $email, $newComment, $feature, $vote);
$name=$_POST['name'];
$email=$_POST['email'];
$newComment=$_POST['comment'];
$feature=$_POST['feature'];
$vote=$_POST['vote'];
$result = mysqli_stmt_execute($stmt);
if ($result) {
http_response_code(200);
echo "Your comment has been sent!";
} else {
http_response_code(500);
echo "Oops! Something went wrong and we couldn't send your comment.";
}
} else {
http_response_code(501);
echo "Oops! There was an error.";
}
mysqli_close($con);
?>