-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcontactus.php
39 lines (33 loc) · 1.14 KB
/
contactus.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
<?php
session_start();
include "functions.php";
$con = mysqli_connect('localhost','root','','Leicester');
if((isset($_POST['submit'])) && ($_POST['submit'] == 'submit2') ){
$msg = $_POST['message'];
$username=$_SESSION['username'];
mysqli_autocommit($con, false);
$query = "insert into contact
(
username,
message
)
Values
(
'$username',
'$msg'
)";
$result = mysqli_query($con, $query);
if ($result) {
mysqli_commit($con);
send_message('Message was sent', 'success');
header("Location: index.php");
exit();
}
}
else if(empty($_post['message']))
{
send_message('No message was found', 'error');
header("Location: contact.php");
exit();
}
?>