forked from 0xkillua/online_education
-
Notifications
You must be signed in to change notification settings - Fork 0
/
contact.php
122 lines (82 loc) · 3.2 KB
/
contact.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
<?php
include 'components/connect.php';
if(isset($_COOKIE['user_id'])){
$user_id = $_COOKIE['user_id'];
}else{
$user_id = '';
}
if(isset($_POST['submit'])){
$name = $_POST['name'];
$name = filter_var($name, FILTER_SANITIZE_STRING);
$email = $_POST['email'];
$email = filter_var($email, FILTER_SANITIZE_STRING);
$number = $_POST['number'];
$number = filter_var($number, FILTER_SANITIZE_STRING);
$msg = $_POST['msg'];
$msg = filter_var($msg, FILTER_SANITIZE_STRING);
$select_contact = $conn->prepare("SELECT * FROM `contact` WHERE name = ? AND email = ? AND number = ? AND message = ?");
$select_contact->execute([$name, $email, $number, $msg]);
if($select_contact->rowCount() > 0){
$message[] = 'message sent already!';
}else{
$insert_message = $conn->prepare("INSERT INTO `contact`(name, email, number, message) VALUES(?,?,?,?)");
$insert_message->execute([$name, $email, $number, $msg]);
$message[] = 'message sent successfully!';
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>contact</title>
<!-- font awesome cdn link -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css">
<!-- custom css file link -->
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<?php include 'components/user_header.php'; ?>
<!-- contact section starts -->
<section class="contact">
<div class="row">
<div class="image">
<img src="images/contact-img.svg" alt="">
</div>
<form action="" method="post">
<h3>get in touch</h3>
<input type="text" placeholder="enter your name" required maxlength="100" name="name" class="box">
<input type="email" placeholder="enter your email" required maxlength="100" name="email" class="box">
<input type="number" min="0" max="9999999999" placeholder="enter your number" required maxlength="10" name="number" class="box">
<textarea name="msg" class="box" placeholder="enter your message" required cols="30" rows="10" maxlength="1000"></textarea>
<input type="submit" value="send message" class="inline-btn" name="submit">
</form>
</div>
<div class="box-container">
<div class="box">
<i class="fas fa-phone"></i>
<h3>phone number</h3>
<a href="tel:1234567890">123-456-7890</a>
<a href="tel:1112223333">111-222-3333</a>
</div>
<div class="box">
<i class="fas fa-envelope"></i>
<h3>email address</h3>
<a href="mailto:[email protected]">[email protected]</a>
<a href="mailto:[email protected]">[email protected]</a>
</div>
<div class="box">
<i class="fas fa-map-marker-alt"></i>
<h3>office address</h3>
<a href="#">flat no. 1, a-1 building, jogeshwari, mumbai, india - 400104</a>
</div>
</div>
</section>
<!-- contact section ends -->
<?php include 'components/footer.php'; ?>
<!-- custom js file link -->
<script src="js/script.js"></script>
</body>
</html>