1 回答
TA贡献1851条经验 获得超4个赞
我使用PHP会话来存储然后删除变量。
<?php
session_start();
$send_form = $_POST["email_form"]; //this is sent by ajax. Will be 'yes' if the form to send has been submitted.
switch ($action){
case 'stripe':
//do stripe transaction
//set a variable to indicate payment is complete using transaction ID
$_SESSION["payment_made"] = $transaction->id;
break;
case 'paypal':
//do paypal transaction
//set a variable to indicate payment is complete using transaction ID
$_SESSION["payment_made"] = $transaction->id;
break;
}
function sendmail() {
//usual php mail function (works fine)
session_unset();
session_destroy();
mail();
}
if ($send_form = 'yes' && $_SESSION["payment_made"] != '') {
sendmail();
}
?>
- 1 回答
- 0 关注
- 77 浏览
添加回答
举报