forked from hngi/HNGi7.0
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontactform.php
155 lines (137 loc) · 5.54 KB
/
contactform.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
<?php
require 'classControllers/init.php';
$contact_mail = new AdminClass;
$validation = new Validation();
if (isset($_POST['contact-btn'])) {
function random_strings($length_of_string) {
return substr ((date('dmys')), 0, $length_of_string);
}
//use this as an example to get form input data
$name = $database->escape_string($_POST["name"]);
$email = $database->escape_string($_POST["email"]);
$subject = $database->escape_string($_POST["subject"]);
$message = $database->escape_string($_POST["message"]);
$ticket = random_strings(10);
//validation of data
$msg = $validation->check_empty($_POST, array('name', 'email', 'subject', 'message'));
$check_email = $validation->is_email_valid($_POST['email']);
// checking empty fields
if ($msg != null) { } elseif (!$check_email) {
$msg2 = 'Please provide proper email.';
} else {
//here is method that will submit mail to database table and you can find it in adminClass
$send = $contact_mail->contactFormMailer($ticket,$name, $email, $subject, $message);
if ($send) {
$ticket = $ticket;
$name = $name;
$subject = $subject;
$body = $message;
//here is the function to send mail to admin email
contactMail($email, $ticket, $name, $subject, $body);
$mess = 'Message Sent you get a feedback from us thank you!';
}
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Contact Us</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet'>
<link rel="icon" type="img/png" href="images/hng-favicon.png">
<link rel="stylesheet" type="text/css" href="css/header-footer.css">
<link rel="stylesheet" href="css/faq.css">
</head>
<body>
<?php
include_once "fragments/site_header.php";
?>
<section class="freq-n">
<div class="container">
<div class="wrap" style="width: 100%;">
<div class="header">
<h1>Not a Frequently Asked Question?</h1>
<h1> contact us below</h1>
</div>
<form class="inputs-wrap" method="post">
<div id="contact-message">
<?php
if (!empty($error)) {
echo "<h4 class='text-danger text-center'>" . $error . "</h4>";
}
if (!empty($mess)) {
echo "<h4 class='text-success text-center success' style='color: green;'>" . $mess . "</h4>";
}
if (!empty($msg)) {
echo "<h4 class='text-danger text-center' style='color: red;'>" . $msg . "</h4>";
}
if (!empty($msg2)) {
echo "<h4 class='text-danger text-center' style='color: red;'>" . $msg2 . "</h4>";
}
?>
</div>
<input type="text" placeholder="Name" name="name" required>
<input type="email" placeholder="Email" name="email" required>
<input type="text" placeholder="Subject" name="subject" required>
<textarea id="" cols="" rows="10" name="message" required></textarea>
<input type="submit" id="submit" value="SEND MESSAGE" name="contact-btn">
</form>
</div>
</div>
</section>
<footer>
<img src="https://res.cloudinary.com/jaycodist/image/upload/v1570722444/hng-brand-logo_gnplmq.svg">
<nav>
<section>
<h2 class="skyblue-text">Quick Links</h2>
<div id="link-list">
<a href="join-intern.php" class="skyblue-text">Join HNGi7.0</a>
<a href="index.php" class="skyblue-text">About HNG</a>
<a href="donate.html" class="skyblue-text">Become a Sponsor</a>
<a href="MentorSetUpPage2.php" class="skyblue-text">Sign up as Mentor</a>
<a href="faq.php" class="skyblue-text">FAQ</a>
<a href="intern-experience.php" class="skyblue-text">Past Intern Experience</a>
</div>
</section>
<section id="contact-section">
<h2 class="skyblue-text">Contact Us</h2>
<div>
<a href="tel:+2348123456789">
<strong>
Phone: <br />
</strong>
+234 812 345 6789
</a>
<br />
<a href="mailto:[email protected]">
<strong>
Email: <br />
</strong>
</a>
</div>
</section>
<section>
<h2 class="skyblue-text">Office Address</h2>
<p id="address">
3 Birrel Avenue <br /> Sabo, Yaba, <br /> Lagos state
</p>
</section>
<section>
<h2 class="skyblue-text">Follow Us</h2>
<div id="socials">
<a href="https://twitter.com/hnginternship" title="Follow on Twitter!"><img src="https://res.cloudinary.com/jaycodist/image/upload/v1570722900/twitter-logo_m1mgzi.svg"></a>
<a href="https://www.facebook.com/HNG-Internship-115577009820117/"><img title="Follow on Facebook!" src="https://res.cloudinary.com/jaycodist/image/upload/v1570722900/facebook-logo_bw1hal.svg"></a>
<a href="https://dribble.com"><img title="Follow on Dribble!" src="https://res.cloudinary.com/jaycodist/image/upload/v1570722900/dribble-logo_w4vwuz.svg"></a>
</div>
</section>
</nav>
<p class="center-text darkblue-text">© 2019, HNG Internship. All rights reserved.</p>
</footer>
</body>
</html>