Link to home
Start Free TrialLog in
Avatar of DS928
DS928Flag for United States of America

asked on

Email Thank You

I am using this code.  Whenever an email is sent another page pops up (thank_you.html) saying thank you.  I don't want that.  I simply want the input field that previously said "Your Email Here" to now say.  "Thank You".    How can I do this?

www.mediascrubber.com/videos.html

Its at the very bottom of the page.  Subscribe.

I assume I would do an echo "Thank You" of some sort.  But where?

<form class="form-horizontal" action="send_mail.php" method="post">
				<div class="input-group">
                <input type="text" name="email_address" class="def-input" placeholder="Your Email Here">
                <span class="input-group-btn">
                <button class="btn-form btn" input type="submit">Subscribe</button>
                </span>
                <!--input type="submit" value="Submit" /-->
				</div>
                </form>

Open in new window


<?php
/*
This first bit sets the email address that you want the form to be submitted to.
You will need to change this value to a valid email address that you can access.
*/
$webmaster_email = "ds@mediascrubber.com";

/*
This bit sets the URLs of the supporting pages.
If you change the names of any of the pages, you will need to change the values here.
*/
//$feedback_page = "feedback_form.html";
//$error_page = "error_message.html";
$thankyou_page = "thank_you.html";

/*
This next bit loads the form field data into variables.
If you add a form field, you will need to add it here.
*/
$email_address = $_REQUEST['email_address'] ;
//$comments = $_REQUEST['comments'] ;

/*
The following function checks for email injection.
Specifically, it checks for carriage returns - typically used by spammers to inject a CC list.
*/
function isInjected($str) {
	$injections = array('(\n+)',
	'(\r+)',
	'(\t+)',
	'(%0A+)',
	'(%0D+)',
	'(%08+)',
	'(%09+)'
	);
	$inject = join('|', $injections);
	$inject = "/$inject/i";
	if(preg_match($inject,$str)) {
		return true;
	}
	else {
		return false;
	}
}

// If the user tries to access this script directly, redirect them to the feedback form,
if (!isset($_REQUEST['email_address'])) {
header( "Location: $feedback_page" );
}

// If the form fields are empty, redirect to the error page.
//elseif (empty($email_address) || empty($comments)) {
//header( "Location: $error_page" );
//}

// If email injection is detected, redirect to the error page.
elseif ( isInjected($email_address) ) {
header( "Location: $error_page" );
}

// If we passed all previous tests, send the email then redirect to the thank you page.
else {
mail( "$webmaster_email", "Feedback Form Results",
  $comments, "From: $email_address" );
header( "Location: $thankyou_page" );
}
?>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Rob
Rob
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of DS928

ASKER

The Thank you works!