forked from pratham0203/lokeshdidwania
-
Notifications
You must be signed in to change notification settings - Fork 0
/
subscribe.php
45 lines (36 loc) · 961 Bytes
/
subscribe.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
<?php
include 'connection.php'; // Connection to the database
if(isset($_POST['submit'])){
//Submitted Form values
$email = $_POST['email'];
//SQL Insert Query
$sql_query = "INSERT INTO subscribers(Email)
VALUES ('$email')";
$ins = mysqli_query($conn,$sql_query);
//
$to = $email;
$subject = "Subsciption to Lokeshdidwania newsletter";
$message = "Hey there,<br><br>Thanks for subscribing to us. <br> We'll notify you when we start.";
$headers = 'From: [email protected]' . "\r\n";
// To send HTML mail, the Content-type header must be set
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
// send email
mail($to,$subject,$message, $headers);
if($ins){
?>
<script>
window.location.replace("../podcast.html");
</script>
<?php
}
else{
?>
<script>
alert("Unable to send email");
window.location.replace("../podcast.html");
</script>
<?php
}
}
?>