0
아래 양식에서이 양식을 사용할 때 PayPal에 다양한 금액을 보내드립니다. 엘리먼트가 브라우저를 통해 검사 할 때 모든 데이터가 정확합니다. Paypal 사이트가 활성화되어있을 때 나는 항상 1 금액 금액 USD25.00을받습니다. $ pitch-> option_value마다 달라야합니다.Paypal이 양식을 통해 잘못된 금액을 가져옵니다.
각 변수 $ pitch-> option_value는 내 사이트에서 정확합니다. 하지만 페이팔에만 25가 표시됩니다.
내가 뭘 잘못하거나 잊어 버리나요?
$i = '1';
foreach($pitches as $pitch) {
if($i == 1) {
$month = __('Month','agent-plugin');
} else {
$month = __('Months','agent-plugin');
}
$content .= '<form id="GotoPaypal" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="charset" value="utf-8">
<input type="hidden" name="return" value="'.get_home_url().'/en/my-account/">
<input type="hidden" name="item_name" value="'.$i.' '.$month.'">
<input type="hidden" name="amount" value="'.$pitch->option_value.'">
<input type="hidden" name="currency_code" value="USD">
<a href="#!" onclick="event.preventDefault();document.getElementById(\'GotoPaypal\').submit();">
</form>';
$i++;
}
return $content;
어디에서 $ i를 증가합니까? Foreach는 그 자체로 값을 증가시키지 않으므로 물론 ($ i = 0; $ i <$ pitches_count; $ i ++) 을 사용하십시오. $ pitches_count = count ($ pitchches); – Trueman
$ i 지불에 대한 추가 정보로 필요합니다. $ month는 금액이 아닌이 예제의 텍스트입니다. 금액은 $ pitch-> option_value로 표시됩니다. 그래서 option_value는 테이블에서 가져옵니다. – Hermants
foreach를 사용할 수도 있지만 foreach의 끝 괄호 앞에 $ i ++를 추가하여 $ i 값을 증가시킵니다. 문 – Trueman