forked from AaravRajSIngh/Chatbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
insert.php
120 lines (88 loc) · 2.17 KB
/
insert.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php
$conn=mysqli_connect("localhost","root","","youtube");
if($conn-> connect_error){
die("connection failed:".$conn-> connect_error);
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Update</title>
<style >
input{
font-size: 1vw;
}
table{
color: white;
border-radius: 19px;
background:linear-gradient(blue,black,blue);
}
#button
{
background-color:rgba(0,0,0,0.6);
color: white;
height: 32px;
width: 145px;
border-radius: 25px;
font-size: 16px;
}
body{
background:linear-gradient(black,black);
background-repeat: no-repeat;
background-attachment: fixed;
background-size: 100% 100%;
}
</style>
</head>
<br><br><br><br><br><br>
<br>
<br>
<form action="" method="POST">
<table border="0" bgcolor="black" align="center" cellspacing="50">
<div id="main-wrapper">
<center>
<div class="imgcontainer">
<img src="image/bot_avatar.png" class="avatar"/>
</center>
</div>
<tr>
<td>Id</td>
<td><input type="text" value="" name="id" placeholder="Type Id here..."required></td>
</tr>
<tr>
<td>Question</td>
<td><input type="text" value="" name="question" placeholder="Type your query here..."required></td>
</tr>
<tr>
<td>Reply</td>
<td><input type="text" value="" name="reply" placeholder="Type your response here..."required></td>
</tr>
</tr>
<tr>
<td colspan="3" align="center"><input type="submit" id="button" name="submit" value="Report as Invalid"/></td>
</tr>
</table>
</form>
</body>
</html>
<?php
if(isset($_POST['submit']))
{
$id=$_POST['id'];
$question=$_POST['question'];
$reply=$_POST['reply'];
$query="insert into chatbot_hints values('$id','$question','$reply')";
$query_run = mysqli_query($conn,$query);
if($query_run)
{
echo '<script type="text/javascript"> alert("Success!") </script>';
}
else
{
echo '<script type="text/javascript"> alert("'.mysqli_error($conn).'") </script>';
}
?>
<META HTTP-EQUIV="Refresh" CONTENT="0; URL=http://localhost:7882/qna.php">
<?php
}
?>