forked from erciitb/ercwebsite_archive
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathform-submit.php
More file actions
33 lines (24 loc) · 875 Bytes
/
form-submit.php
File metadata and controls
33 lines (24 loc) · 875 Bytes
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
<?php
// setting the email to be sent to
$myEmail = "erciitbombay@gmail.com";
// getting user variables
$userName = $_POST['name'];
$userEmail = $_POST['email'];
$userMessage = $_POST['message'];
// setting email parameters
$emailSubject = "New Form submission on ERC Website by ".$userName;
$emailBody = "You have received a new message. \nHere are the details:\n\tUsername: $userName\n\tEmail: $userEmail\n\tMessage \n\t$userMessage";
// defining mail information
$to = "erciitbombay@gmail.com";
$headers = "From: ".$userName."\r\n";
$headers .= "Reply-To: ".$userEmail."\r\n";
$send = mail( $to, $emailSubject, $emailBody, $headers);
if ($send) {
echo 'Redirecting to home page';
$URL="index.html";
echo "<script type='text/javascript'>window.location.href='$URL';</script>";
} else {
echo 'there is some problem';
}
//redirect to the main page
?>