Hello, I am trying to make the following code work and having issues. Here's the original code: <?php require_once ("paypalfunctions.php"); $PaymentOption = "PayPal"; if ( $PaymentOption == "PayPal") { $paymentAmount = "1.00"; $currencyCodeType = "USD"; $paymentType = "Sale"; $returnURL = "../files/adjectives1.pdf"; $cancelURL = "../cartTest/cancel.php"; $items = array(); $items[] = array('name' => 'Item Name', 'amt' => $paymentAmount, 'qty' => 1); $resArray = SetExpressCheckoutDG( $paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL, $items ); $ack = strtoupper($resArray["ACK"]); if($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING") { $token = urldecode($resArray["TOKEN"]); RedirectToPayPalDG( $token ); } else { $ErrorCode = urldecode($resArray["L_ERRORCODE0"]); $ErrorShortMsg = urldecode($resArray["L_SHORTMESSAGE0"]); $ErrorLongMsg = urldecode($resArray["L_LONGMESSAGE0"]); $ErrorSeverityCode = urldecode($resArray["L_SEVERITYCODE0"]); echo "SetExpressCheckout API call failed. "; echo "Detailed Error Message: " . $ErrorLongMsg; echo "Short Error Message: " . $ErrorShortMsg; echo "Error Code: " . $ErrorCode; echo "Error Severity Code: " . $ErrorSeverityCode; } } ?> Code (markup): I'm trying to get this form to fetch info from my db (id,name,price) Obviously I am missing a step or two. Here are the changes I made: <?php require_once ("paypalfunctions.php"); require_once('dbSettings.php'); $PaymentOption = "PayPal"; if ( $PaymentOption == "PayPal") { $paymentAmount = ',$item['price'],'; $currencyCodeType = "USD"; $paymentType = "Sale"; $returnURL = "../files/adjectives1.pdf"; $cancelURL = "../cartTest/cancel.php"; $items = array(); $items[] = array('name' => 'Item Name', 'amt' => $paymentAmount, 'qty' => 1); $resArray = SetExpressCheckoutDG( $paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL, $items ); $ack = strtoupper($resArray["ACK"]); if($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING") { $token = urldecode($resArray["TOKEN"]); RedirectToPayPalDG( $token ); } else { $ErrorCode = urldecode($resArray["L_ERRORCODE0"]); $ErrorShortMsg = urldecode($resArray["L_SHORTMESSAGE0"]); $ErrorLongMsg = urldecode($resArray["L_LONGMESSAGE0"]); $ErrorSeverityCode = urldecode($resArray["L_SEVERITYCODE0"]); echo "SetExpressCheckout API call failed. "; echo "Detailed Error Message: " . $ErrorLongMsg; echo "Short Error Message: " . $ErrorShortMsg; echo "Error Code: " . $ErrorCode; echo "Error Severity Code: " . $ErrorSeverityCode; } } ?> Code (markup): I just started playing with PHP and no very little so the more details you give are greatly appreciated.
If you are just started playing with PHP, please stop then. Paypal isn't just for users that just play with PHP But if you realy want to do it yourselve please describe in steps what you have done and what doens't work! i'm not going to read all code and try to see what's wrong or what should be added.. only can help you if you are stuck somewhere.
What I can say is that you only have DB settings but no connection has been made to your DB. Try to find where in your code that you mentioned about DB name, DB table