JSFiddle - React, Tailwind, and code Playground
by Vanessa RC
HTML
<div class="subscribe-widget">
<div class="widget-subscribe-form-result"></div>
<form id="widget-subscribe-form2" action="include/quickcontact-subscribe.php" role="form" method="post" class="nobottommargin">
<div class="input-group input-group-lg divcenter" style="max-width:600px;" id="quick-contact-form-email">
<span class="input-group-addon"><i class="icon-email2"></i></span>
<input type="email" name="widget-subscribe-form-email" class="form-control required email" placeholder="Enter your Email">
<span class="input-group-btn">
<button class="btn btn-default" type="submit">Subscribe</button>
</span>
</div>
</form>
</div>
JavaScript
<?php
require_once('phpmailer/PHPMailerAutoload.php');
$apiKey = 'dcee803c4fa38d16d663163f77dd0514-us11'; // Your MailChimp API Key
$listId = 'e3f6d54bb7'; // Your MailChimp List ID
$toemails = array();
$toemails[] = array(
'email' => '[email protected]', // Your Email Address
'name' => 'BridgePay' // Your Name
);
// Form Processing Messages
$message_success = 'We have <strong>successfully</strong> received your Message and will get Back to you as soon as possible.';
// Add this only if you use reCaptcha with your Contact Forms
/*$recaptcha_secret = ''; // Your reCaptcha Secret*/
$mail = new PHPMailer();
// If you intend you use SMTP, add your SMTP Code after this Line
if( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
if( $_POST['quick-contact-form-email'] != '' ) {
//$name = $_POST['quick-contact-form-name'];
$email = $_POST['quick-contact-form-email'];
$subscribe_email = $email;
//$message = $_POST['quick-contact-form-message'];
$subject = 'New Subscriber from the Website';
$botcheck = $_POST['quick-contact-form-botcheck'];
if( isset( $_GET['list'] ) AND $_GET['list'] != '' ) {
$listId = $_GET['list'];
}
if( $botcheck == '' ) {
$mail->SetFrom( $email );
$mail->AddReplyTo( $email );
foreach( $toemails as $toemail ) {
$mail->AddAddress( $toemail['email'] , $toemail['name'] );
}
$mail->Subject = $subject;
$name = isset($name) ? "Name: $name<br><br>" : '';
$email = isset($email) ? "Email: $email<br><br>" : '';
//$message = isset($message) ? "Message: $message<br><br>" : '';
$referrer = $_SERVER['HTTP_REFERER'] ? '<br><br><br>This Form was submitted from: ' . $_SERVER['HTTP_REFERER'] : '';
$body = "$name $email $message $referrer";
// Runs only when reCaptcha is present in the Contact Form
if( isset( $_POST['g-recaptcha-response'] ) ) {
$recaptcha_response = $_POST['g-recaptcha-response'];
//$response = file_get_contents(...