Php Paypal buy now按钮传递一些变量,但不是全部变量

Php Paypal buy now按钮传递一些变量,但不是全部变量,php,paypal,Php,Paypal,我有一个问题,我正在为客户的网站创建一个贝宝立即购买按钮。虽然名字、姓氏、电子邮件地址和商品名称都在进行中,但账单地址和价格都在进行中。很奇怪,这应该是一个简单的过程。这是我的密码: $invoicenumber = $row['InvoiceNumber']; $totalquantity = $row['TotalQuantity']; $totalprice = $row['TotalPrice']; $costofshipping = $row['CostOfShipping']; $f

我有一个问题,我正在为客户的网站创建一个贝宝立即购买按钮。虽然名字、姓氏、电子邮件地址和商品名称都在进行中,但账单地址和价格都在进行中。很奇怪,这应该是一个简单的过程。这是我的密码:

$invoicenumber = $row['InvoiceNumber'];
$totalquantity = $row['TotalQuantity'];
$totalprice = $row['TotalPrice'];
$costofshipping = $row['CostOfShipping'];
$firstname = $row['FirstName'];
$lastname = $row['LastName'];
$billingstreetaddress = $row['BillingStreetAddress'];
$billingapartmentnumber = $row['BillingApartmentNumber'];
$billingcity = $row['BillingCity'];
$billingstate = $row['BillingState'];
$billingzipcode = $row['BillingZipCode'];
$emailaddress = $row['EmailAddress'];
echo "<form action='https://www.paypal.com/cgi-bin/webscr' method='post'>
<input type='hidden' name='cmd' value='_s-xclick'>
<INPUT TYPE='hidden' NAME='business' VALUE='payments@companyname.com'>
<INPUT TYPE='hidden' NAME='invoice' VALUE='$invoicenumber'>
<INPUT TYPE='hidden' NAME='undefined_quantity' VALUE='$totalquantity'>
<INPUT TYPE='hidden' NAME='item_name' VALUE='CompanyNamePurchase'>
<INPUT TYPE='hidden' NAME='amount' VALUE='$totalprice'>
<INPUT TYPE='hidden' NAME='shipping' VALUE='$costofshipping'>
<INPUT TYPE='hidden' NAME='currency_code' VALUE='USD'>
<INPUT TYPE='hidden' NAME='first_name' VALUE='$firstname'>
<INPUT TYPE='hidden' NAME='last_name' VALUE='$lastname'>
<INPUT TYPE='hidden' NAME='address1' VALUE='$billingstreetaddress'>
<INPUT TYPE='hidden' NAME='address2' VALUE='$billingapartmentnumber'>
<INPUT TYPE='hidden' NAME='city' VALUE='$billingcity'>
<INPUT TYPE='hidden' NAME='state' VALUE='$billingstate'>
<INPUT TYPE='hidden' NAME='zip' VALUE='$billingzipcode'>
<INPUT TYPE='hidden' NAME='lc' VALUE='US'>
<INPUT TYPE='hidden' NAME='email' VALUE='$emailaddress'>
input type='hidden' name='hosted_button_id' value='paypalclientnumber'>
<input type='image' id='paypalsubmitbutton' style='top:750px;left:65%;position:absolute;'     src='https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif' border='0'    name='submit' alt='PayPal - The safer, easier way to pay online!'>
<img alt='' border='0' src='https://www.paypalobjects.com/en_US/i/scr/pixel.gif'    width='1' height='1'>
</form>";
$invoicenumber=$row['invoicenumber'];
$totalquantity=$row['totalquantity'];
$totalprice=$row['totalprice'];
$costofshipping=$row['costofshipping'];
$firstname=$row['firstname'];
$lastname=$row['lastname'];
$billingstreetaddress=$row['billingstreetaddress'];
$BillingPartmentNumber=$row['BillingPartmentNumber'];
$billingcity=$row['billingcity'];
$billingstate=$row['billingstate'];
$billingzipcode=$row['billingzipcode'];
$emailaddress=$row['emailaddress'];
回声“
输入类型class='hidden'name='hosted\u button\u id'value='paypalclientnumber'>
";
/*这是源代码-正如你所看到的,没有发票号码通过,价格和数量为零,地址在那里,但没有通过贝宝。运费也在那里*/

<form action='https://www.paypal.com/cgi-bin/webscr' method='post'>
<input type='hidden' name='cmd' value='_s-xclick'>
<INPUT TYPE='hidden' NAME='business' VALUE='payments@companyname.com'>
<INPUT TYPE='hidden' NAME='invoice' VALUE=''>
<INPUT TYPE='hidden' NAME='undefined_quantity' VALUE='0'>
<INPUT TYPE='hidden' NAME='item_name' VALUE='CompanyNamePurchase'>
<INPUT TYPE='hidden' NAME='amount' VALUE='0.00'>
<INPUT TYPE='hidden' NAME='shipping' VALUE='7.00'>
<INPUT TYPE='hidden' NAME='currency_code' VALUE='USD'>
<INPUT TYPE='hidden' NAME='first_name' VALUE='Multigrain'>
<INPUT TYPE='hidden' NAME='last_name' VALUE='Cheerios'>
<INPUT TYPE='hidden' NAME='address1' VALUE='2 Spoonful Way'>
<INPUT TYPE='hidden' NAME='address2' VALUE='myemailaddress@email.com'>
<INPUT TYPE='hidden' NAME='city' VALUE='Brooklyn'>
<INPUT TYPE='hidden' NAME='state' VALUE='New York'>
<INPUT TYPE='hidden' NAME='zip' VALUE='11203'>
<INPUT TYPE='hidden' NAME='lc' VALUE='US'>
<INPUT TYPE='hidden' NAME='email' VALUE=''>
<input type='hidden' name='hosted_button_id' value='paypalidjumbledletters&#s'>
<input type='image' id='paypalsubmitbutton'     style='top:750px;left:65%;position:absolute;' src='https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif' border='0' name='submit' alt='PayPal - The safer, easier way to pay online!'>
<img alt='' border='0' src='https://www.paypalobjects.com/en_US/i/scr/pixel.gif' width='1' height='1'>
</form>


除了确保该按钮是未隐藏的按钮外,如果您在传递地址变量时遇到问题,请确保状态是缩写的,即MA而不是Massachusetts。这就是我的解决方案。

让我猜猜。。。缺少的选项是
paypalsubmitbutton=paypalclientnumber
?尽管如此,我认为这不是解决这个问题的合适论坛。你能给我们展示一下在页面源代码中获得输出的实际代码,而不是PHP生成的代码吗?从您所展示/说的内容来看,我假设您的PHP值没有按照您认为的方式填充。看起来地址肯定在那里,那么为什么它没有出现在paypal收银台上呢?然而,价格显示为0,尽管该变量绝对正确。我在paypal按钮上方有一个select sql查询,而且变量肯定会被填充,特别是当一些变量被填充时。已检查以确保变量中的列名正确。我将确保price变量实际设置为正确的值。