-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathguestbook.php
246 lines (190 loc) · 4.64 KB
/
guestbook.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
<html>
<head>
<title>Greek Factory</title>
</head>
<?php
session_start();
?>
<body class="padding" background="bg/thankyou.png">
<div style="100%">
<ul class="horizontalul">
<li><a class="active" href="homef.php">Home</a></li>
<li><a href="Menu.php">Menu</a>
<ul>
<li ><a href="special.php">Specialities</li>
<li ><a href="Snacks.php">Snacks</li>
<li ><a href="Soups.php">Soups</li>
<li ><a href="Starters.php">Starters</li>
<li ><a href="MainCourse.php">Main Course</li>
<li ><a href="Desserts.php">Desserts</li>
<li ><a href="Drinks.php">Drinks</li>
</ul>
<li><a href="gallery.php">Gallery</a></li>
<li><a href="order.php">Order Online</a></li>
<li><a href="guestbook.php">Guset Book</a></li>
<li><a href="contact.php">Contact</a></li>
<li><a href="about.php">About us</a></li>
</ul>
</div>
<div style="float:left; width:20%;">
<form class="innershadow" action="" method="post" enctype="multipart/form-data">
<!center> <fieldset class="padding">
<legend>Comments</legend>
<pre>
Name : <input type="text" name="uname" required >
Email Id : <input type="mail" name="mail" required>
comments :
<textarea name="comments" required rows="8" cols="40" ></textarea>
</pre></center><br>
<center><input type="submit" value="Comment" name="save"><br><br>
</div>
<div style="float:right; width:40%;">
<?php
// Connecting to Data Base
$mysqlport = getenv('S2G_MYSQL_PORT');
$dbhost = "localhost:".$mysqlport;
$dbuser = 'root';
$dbpass = '';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
$dbname = 'details';
mysql_select_db($dbname);
if(isset($_POST['save']))
{
$name=$_POST['uname'];
$mail=$_POST['mail'];
$comment=$_POST['comments'];
//insert to database
$query= mysql_query("INSERT INTO comments(name,mail,comments) values('$name','$mail','$comment')");
if($query)
{
}
else if(!$query)
{
echo "not save";
}
}
mysql_close();
?>
<?php
// Connecting to Data Base
$mysqlport = getenv('S2G_MYSQL_PORT');
$dbhost = "localhost:".$mysqlport;
$dbuser = 'root';
$dbpass = '';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
$dbname = 'details';
mysql_select_db($dbname);
$query="select * from comments";
$result=mysql_query($query,$conn);
if (!mysql_query($query,$conn))
{
die('Error: ' . mysql_error());
}
echo "<table class='tt' cellpadding='10' rules='rows' border='2' cellspacing='50' height='200'>
<tr>
<th>Name</th>
<th>Mail Id</th>
<th>Comments</th>
</tr>";
while($row1 = mysql_fetch_array($result))
{
echo "<tr size='10%'>";
echo "<td >" . $row1['name']; "</td>";
echo "<td>" . $row1['mail'];"</td>";
echo "<td>" . $row1['comments'];"</td>";
echo "</tr>";
}
echo "</table>";
?>
</div>
</body>
</html>
<style type="text/css">
table.tt
{
border:2;
display:block;
border-style:
cellspacing:10;
}
fieldset.padding
{
padding-top:2%;
padding-bottom:0%;
padding-right:5%;
padding-left:15px;
height:360px;
width:10%;
border-style:outset;
border-width:5px ;
}
div#header {
background-color: darkgoldenrod;
text-align: -webkit-center;
color: beige;
padding: 0%;
}
ul
{
height:7%;
list-style-type:none;
margin: 0;
padding :0;
overflow:hidden;
background;
position:none;
top:100%;
width:100%
}
li
{
float:left;
}
li:last-child
{
float:left;
border-right:none;
}
li a{
display:block;
color:black;
text-align:center;
padding:14px 16px;
text-decoration:;
}
li a:hover
{
a:active
{
background-color:#111
};
background-color:FFFF00;
}
p.one
{
border-style:solid;
border-width:5px;
}
frameset.two
{
border-style:solid;
border-width:medium;
}
a { text-decoration:none }
p.three
{
border-style:solid;
border-width:1px;
}
li ul { margin:0; padding:0 5px; line-height:none;height:42%;
position:absolute; top:29px; left:0; border:solid 1px #c93300; border-width:0px 1px 1px 1px; width:180px; display:none; background:#FFFFFF;}
li:hover ul { display:block }
li:hover a {color:white; background::#4CAF50;
}
li ul li { display:block; border-bottom:solid 3px #888888 ; width:100%; background:url(images/d_horizontal_red_classic_menu_arrow.gif) no-repeat 3px 12px; padding:10px 2px 10px; }
li ul li:last-child { border-bottom:0px;}
li ul a { border-width:10px; color:#909090; padding:0 5px 0 0; background-color:transparent;}
li:hover ul li a { color:#909090}
li ul li a:hover {color:white; background::#4CAF50;
}
</style>