gpt4 book ai didi

php - 将 paypal 支付网关与 Select php 集成

转载 作者:太空宇宙 更新时间:2023-11-03 15:47:27 25 4
gpt4 key购买 nike

大家好,我一直在尝试在我的网站上添加 Paypal 支付系统但是当我点击提交时,它会重置选定的值并选择第一个然后提交给 Paypal 。在这里,我希望它提交正确选择的 option。我绑定(bind)了几个方法但失败了。我希望有人能帮助我解决这个问题。我希望它在 Select 中提交正确选择的选项。但它只提交第一个。请修改代码和评论:)

<form id='paypal-info' method='post' action='#'>

FACEBOOK_ID</br>
<input name="fbid" value="" /></br>

<select class="form-control" value="" name="mode" id="mode">
<option value="gems">1300 Gems $5.00 USD</option>
<option value="gems1">3000 Gems $10.00 USD</option>
<option value="gems2">8000 Gems $25.00 USD</option>
<option value="gems3">17000 Gems $50.00 USD</option>
<option value="gems4">36000 Gems $100.00 USD</option>
<option value="gems5">76000 Gems $200.00 USD</option>
</select>

<input type='submit' name='pay_now' id='pay_now' value='Pay' />
</form>
<?php

if(isset($_POST['pay_now'])){
$data=array(
'merchant_email'=>'c1296562@opayq.com',
'currency_code'=>'USD',
'thanks_page'=>"http://mywebsite/tools/success.php",
'notify_url'=>"http://mywebsite/tools/cancel.php",
'cancel_url'=>"http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'],
'paypal_mode'=>true,
);
if($_POST['mode'] = gems) {
$product_name = "1300 Gems";
$amount = "5.00";
}elseif($_POST['mode']=gems1){
$product_name = "3000 Gems";
$amount = "10.00";
}elseif($_POST['mode']=gems2){
$product_name = "8000 Gems";
$amount = "25.00";
}elseif($_POST['mode']=gems3){
$product_name = "17000 Gems";
$amount = "50.00";
}elseif($_POST['mode']=gems4){
$product_name = "36000 Gems";
$amount = "100.00";
}elseif($_POST['mode']=gems5){
$product_name = "76000 Gems";
$amount = "200.00";
}

$fbid=$_POST['fbid'];
echo infotutsPaypal($data,$product_name,$amount,$fbid);

}

function infotutsPaypal( $data,$product_name,$amount,$fbid) {

define( 'SSL_URL', 'https://www.paypal.com/cgi-bin/webscr' );
define( 'SSL_SAND_URL', 'https://www.sandbox.paypal.com/cgi-bin/webscr' );

$action = '';
//Is this a test transaction?
$action = ($data['paypal_mode']) ? SSL_SAND_URL : SSL_URL;

$form = '';

$form .= '<form name="frm_payment_method" action="' . $action . '" method="post">';
$form .= '<input type="hidden" name="business" value="' . $data['merchant_email'] . '" />';
// Instant Payment Notification & Return Page Details /
$form .= '<input type="hidden" name="notify_url" value="' . $data['notify_url'] . '" />';
$form .= '<input type="hidden" name="cancel_return" value="' . $data['cancel_url'] . '" />';
$form .= '<input type="hidden" name="return" value="' . $data['thanks_page'] . '" />';
$form .= '<input type="hidden" name="rm" value="2" />';
// Configures Basic Checkout Fields -->
$form .= '<input type="hidden" name="lc" value="" />';
$form .= '<input type="hidden" name="no_shipping" value="1" />';
$form .= '<input type="hidden" name="no_note" value="1" />';
// <input type="hidden" name="custom" value="localhost" />-->
$form .= '<input type="hidden" name="currency_code" value="' . $data['currency_code'] . '" />';
$form .= '<input type="hidden" name="item_name" value="'.$product_name.'" />';
$form .= '<input type="hidden" value="_xclick" name="cmd"/>';
$form .= '<input type="hidden" name="amount" value="'.$amount.'" />';
$form .= '<input type="hidden" name="page_style" value="paypal" />';
$form .= '<input type="hidden" name="charset" value="utf-8" />';
$form .= '<input type="hidden" name="on1" value="'.$fbid.'">';
$form .= '<script>';
$form .= 'setTimeout("document.frm_payment_method.submit()", 1);';
$form .= '</script>';
$form .= '</form>';
return $form;
}
?>

最佳答案

我在 php 代码中看到,您在 if 语句中将 = 更改为 ==,= 用于设置值,而 == 用于相等

关于php - 将 paypal 支付网关与 Select php 集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31010024/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com