-
Notifications
You must be signed in to change notification settings - Fork 0
/
inserts.php
89 lines (79 loc) · 3.63 KB
/
inserts.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
<!DOCTYPE html>
<html lang="en">
<head>
<title>K17 Blog</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</head>
<link rel="icon" href="/k17blog/img/k.jpg" sizes="16x16" type="image/png">
<body>
<div class="container-fluid">
<nav role="navigation" class="navbar navbar-inverse navbar-static-top">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="/k17blog/index.php">
<img alt="CEG LOGO" src="/k17blog/img/cegsymbol.png" height="35" width="40" align="left">
</a>
<a class="navbar-brand" href="/k17blog/index.php">k17! Blog</a>
</div>
<ul class="nav navbar-nav">
<li><a href="/k17blog/index.php"><span class="glyphicon glyphicon-home"></span> Home</a></li>
<!-- <li><a href="#"><span class="glyphicon glyphicon-book"></span> Literature</a></li>
<li><a href="#"><span class="glyphicon glyphicon-facetime-video"></span> Media</a></li>
<li><a href="#"><span class="glyphicon glyphicon-glass"></span> Sports</a></li>-->
<li><a href="/k17blog/insert.html"><span class="glyphicon glyphicon-paperclip"></span> New Post</a></li>
<li><a href="/k17blog/genid.html"><span class="glyphicon glyphicon-refresh"></span> Blog Id</a></li>
<li><a href="/k17blog/searchid.
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="active"><a href="/k17blog/feedback.html"><span class="glyphicon glyphicon-send"></span> Feed Back</a></li>
<li><a href="#"><span class="glyphicon glyphicon-search"></span> Search</a></li>
<li><a href="/k17blog/contact.php"><span class="glyphicon glyphicon-map-marker"></span> Contact Us</a></li>
</ul>
</div>
</nav>
</div>
<br>
<table width="100%">
<tr>
<td><img src="/k17blog/img/cegfinal.png" alt="CEG Logo" height="100" width="200"></td>
<td><p align="center"><img src="/k17blog/img/k17.png" alt="k Logo" height="100" width="275"></td>
<td align="right"><img src="/k17blog/img/unesco.jpg" alt="Unesco Logo" height="100" width="275"></td>
</tr>
</table>
<hr>
<br><br>
<?php
/* Attempt MySQL server connection. Assuming you are running MySQL
server with default setting (user 'root' with no password) */
$link = mysqli_connect("localhost", "root", "root", "blog");
// Check connection
if($link === false){
die("ERROR: Could not connect. " . mysqli_connect_error());
}
// Escape user inputs for security
$first_name = mysqli_real_escape_string($link, $_POST['fname']);
$last_name = mysqli_real_escape_string($link, $_POST['lname']);
$email_address = mysqli_real_escape_string($link, $_POST['email']);
$va = mysqli_real_escape_string($link, $_POST['vai']);
$vaa = mysqli_real_escape_string($link, $_POST['vaii']);
$vaaa= mysqli_real_escape_string($link, $_POST['vaiii']);
$vaaaa = mysqli_real_escape_string($link, $_POST['vaiiii']);
// attempt insert query execution
$sql = "INSERT INTO `feedback`(`name`, `address`, `phone`, `email`, `star`, `good`, `bad`) VALUES ('$first_name', '$last_name', '$email_address','$va','$vaa','$vaaa','$vaaaa')";
if(mysqli_query($link, $sql)){
echo "<h1><div style='text-align:center'>Feedback Sent</h1></div>";
} else{
echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
// close connection
mysqli_close($link);
?>
<ul class="pager">
<li><a href="/k17blog/index.php">Previous</a></li>
</ul>
</body>
</html>