-
Notifications
You must be signed in to change notification settings - Fork 20
/
form_handler.php
37 lines (31 loc) · 1.04 KB
/
form_handler.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
<?php
$field_name = $_POST['name'];
$field_email = $_POST['email'];
$field_college = $_POST['college'];
$field_no = $_POST['phone'];
$field_message = $_POST['message'];
$mail_to = '[email protected]';
$subject = 'Message from a site visitor '.$field_name;
$body_message = 'From: '.$field_name."\n";
$body_message .= 'E-mail: '.$field_email."\n";
$body_message .= 'Phone Number: '.$field_no."\n";
$body_message .= 'College: '.$field_college;
$body_message .= 'Message: '.$field_message;
$headers = 'From: '.$field_email."\r\n";
$headers .= 'Reply-To: '.$field_email."\r\n";
$mail_status = mail($mail_to, $subject, $body_message, $headers);
if ($mail_status) { ?>
<script language="javascript" type="text/javascript">
alert('Thank you we will reply back shortly.');
window.location = 'index.html';
</script>
<?php
}
else { ?>
<script language="javascript" type="text/javascript">
alert('Something went wrong. Please try again or contact at [email protected]');
window.location = 'index.html';
</script>
<?php
}
?>