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')
Related Article: Need help with PHP email form please
is a PHP discussion thread by vanessia_1999 that has 2 replies, was last updated 8 months ago and has been tagged with the keywords: action, script, php, flash, email, form, contact.
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