We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,492 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

How to creaye a PHP Email sent IF APPROVED script?

First off, hey everyone just want to let you know I am still very novice when it comes to PHP. Ok so first I will tell you what I am using:

I have created a donation form in php that is integrated with authorize.net. I have a processpayment.php that will either send a user to a approved.php or denied.php page.

So in my processpayment.php file I have the following "if statement that will either send a user to approved.php/denied.php page:

if($response->IsApproved())
		{
			header("Location: " . $GatewaySettings['PaymentApprovedPage']);
		}

else
			header("Location: " . $GatewaySettings['PaymentDeniedPage'] . "?gateway_error=" . rawurlencode($response->GetField("ResponseReasonText")));
	}
	else
			header("Location: " . $GatewaySettings['PaymentDeniedPage'] . "?gateway_error=" . rawurlencode($transaction->GetErrorString($errorCode)));

?>

Ok so you instead of just going to the 'PaymentApprovedPage' upon approval I would like it to send an email to my client from the form and then go to 'PaymentApprovedPage'. So how would I have two php files upon approval like: someone presses submit and then the action is processpayment.php then it goes to sendmail.php and then go to approved.php (which is 'PaymentApprovedPage')

3
Contributors
5
Replies
2 Years
Discussion Span
4 Months Ago
Last Updated
7
Views
Question
Answered
drewpark88
Junior Poster
180 posts since Feb 2010
Reputation Points: 45
Solved Threads: 5
Skill Endorsements: 0

You probably guessed but I meant create and not creaye

drewpark88
Junior Poster
180 posts since Feb 2010
Reputation Points: 45
Solved Threads: 5
Skill Endorsements: 0

You probably guessed but I meant create and not creaye

Hi Drew,

Everyone makes spelling mistakes :P

if($response->IsApproved()) {
	$eol = "\r\n";
	$to = ""; //the recipitant
	$subject = ""; // the subject
	$message = ""; // the thank you message
	$headers = "From: Drew Park <no-reply@your-domain>$eol";
	
	if(@mail($to, $subject, $message, $headers)) {
		header("Location: " . $GatewaySettings['PaymentApprovedPage']);
	}
}

else {
	header("Location: " . $GatewaySettings['PaymentDeniedPage'] . "?gateway_error=" . rawurlencode($response->GetField("ResponseReasonText")));
}

else {
	header("Location: " . $GatewaySettings['PaymentDeniedPage'] . "?gateway_error=" . rawurlencode($transaction->GetErrorString($errorCode)));
}
?>
diskhub
Newbie Poster
10 posts since Nov 2007
Reputation Points: 10
Solved Threads: 4
Skill Endorsements: 0

I really appreciate any help I can get! I sometimes struggle with code and I have no one to turn to because I have no coding friends. So once again thank you : )

Hi Drew,

Everyone makes spelling mistakes :P

if($response->IsApproved()) {
	$eol = "\r\n";
	$to = ""; //the recipitant
	$subject = ""; // the subject
	$message = ""; // the thank you message
	$headers = "From: Drew Park <no-reply@your-domain>$eol";
	
	if(@mail($to, $subject, $message, $headers)) {
		header("Location: " . $GatewaySettings['PaymentApprovedPage']);
	}
}

else {
	header("Location: " . $GatewaySettings['PaymentDeniedPage'] . "?gateway_error=" . rawurlencode($response->GetField("ResponseReasonText")));
}

else {
	header("Location: " . $GatewaySettings['PaymentDeniedPage'] . "?gateway_error=" . rawurlencode($transaction->GetErrorString($errorCode)));
}
?>
drewpark88
Junior Poster
180 posts since Feb 2010
Reputation Points: 45
Solved Threads: 5
Skill Endorsements: 0

I really appreciate any help I can get! I sometimes struggle with code and I have no one to turn to because I have no coding friends. So once again thank you : )

did it work?

diskhub
Newbie Poster
10 posts since Nov 2007
Reputation Points: 10
Solved Threads: 4
Skill Endorsements: 0
Question Answered as of 3 Years Ago by diskhub

I just want to ask if their is someone knew what to do in order to create codes that will make the customer will know that their ordered products are have been approved by the admin. Thankyou and Godbless.

fourseason
Newbie Poster
1 post since Jan 2013
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page generated in 0.1073 seconds using 2.78MB