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')

You probably guessed but I meant create and not creaye

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)));
}
?>
commented: This helped sooo much! Thanks +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)));
}
?>

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?

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.