Jump to content
Larry Ullman's Book Forums

Necuima

Members
  • Posts

    359
  • Joined

  • Last visited

  • Days Won

    7

Necuima last won the day on April 24 2020

Necuima had the most liked content!

Recent Profile Visitors

3451 profile views

Necuima's Achievements

Newbie

Newbie (1/14)

  • Week One Done Rare
  • One Month Later Rare
  • One Year In Rare

Recent Badges

18

Reputation

  1. This is now in production. I've attached the code for anyone else who might be in a similar situation. if ($local) { // development echo <<<DD1 <!-- DEVELOPMENT TEST!!!--> <div class="paypal_box"> <!-- right-shifts the div --> <!-- first the PayPal Logo - see: https://www.paypal.com/us/webapps/mpp/logo-center --> <img class="PP_logo" src="./images/PP_logo.jpg" alt="PayPal Logo"> <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="xxx@yyy.com.au"> <input type="hidden" name="item_name" value="Selected Items"> <input type="hidden" name="item_number" value=""> <input type="hidden" name="amount" value="$total"> <input type="hidden" name="handling" value="0.00"> <input type="hidden" name="shipping" value="0.00"> <input type="hidden" name="currency_code" value="AUD"> <input type="hidden" name="lc" value="AU"> <input type="hidden" name="bn" value="PP-BuyNowBF"> <input type="hidden" name="add" value="1"> <input type="image" src="./images/PayPal_Button.jpg" alt="Submit" width="100"> <!-- the submit button --> </form> </div> <!-- end paypal_box class div --> <br /><br /> DD1; } // end development else { // production - see: https://cvconnect.commercevision.com.au/display/KB/PayPal+Payments echo <<<DD2 <!-- PRODUCTION!!!--> <div class="paypal_box"> <!-- right-shifts the div --> <!-- first the PayPal Logo - see: https://www.paypal.com/us/webapps/mpp/logo-center --> <img class="PP_logo" src="./images/PP_logo.jpg" alt="PayPal Logo"> <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="xxx@yyy.com.au"> <input type="hidden" name="item_name" value="Selected Items"> <input type="hidden" name="item_number" value=""> <input type="hidden" name="amount" value="$total"> <input type="hidden" name="handling" value="0.00"> <input type="hidden" name="shipping" value="0.00"> <input type="hidden" name="currency_code" value="AUD"> <input type="hidden" name="lc" value="AU"> <input type="hidden" name="return" value="https://xxx/index.php?p=thanks_3"> <input type="hidden" name="cancel_return" value="https://xxx/index.php?p=cancel_3"> <input type="hidden" name="bn" value="PP-BuyNowBF"> <input type="hidden" name="add" value="1"> <input type="image" src="./images/PayPal_Button.jpg" alt="Submit" width="100"> <!-- the submit button --> </form> </div> <!-- end paypal_box class div --> <br /><br /> DD2; } // end production You will recognise the "$local" from one of your other books 🙂 As an aside, when obtaining guidance from your E-Commerce book, I used PDO for all database activities and that has worked fine. All the best, Necuima
  2. Hi Larry, I just want to say "Thanks" for the guidance from this book and also the E-Commerce book. I followed a lot of the e-commerce guidance for a shopping cart, PayPal and used MySQL joins as per this book and eventually all went well. Cheers from Oz, Necuima
  3. I got there in the end after going down many 'blind alleys'. <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_blank"> <input type="hidden" name="cmd" value="_xclick"> <!-- <input type="hidden" name="cmd" value="_cart"> --> <input type="hidden" name="business" value="xxxx@yyyy.com.au"> <input type="hidden" name="item_name" value="Item Description"> <input type="hidden" name="item_number" value=""> <input type="hidden" name="amount" value="$total"> <input type="hidden" name="handling" value="0.00"> <input type="hidden" name="shipping" value="0.00"> <input type="hidden" name="currency_code" value="AUD"> <input type="hidden" name="lc" value="AU"> <input type="hidden" name="bn" value="PP-BuyNowBF"> <input type="hidden" name="add" value="1"> <input type="image" src="./images/PayPal_Button.jpg" alt="Submit" width="100"> <!-- the submit button --> </form> Cheers from Oz.
  4. Hi Larry, From SO the second code should not have the HTML form tags so I removed them but it still does not work. I have also tried that code just in a simple HTML script but still no access to PP. I would prefer to use the first script as at least it got me to PayPal if only I could find a way to set the currency to Australian dollars! This must be a common thing to do - have a shopping cart in your PHP code and then just interface to PayPal with a single amount to process the financial transaction. I have done similar with Stripe and that works fine but, as mentioned, the website owner insists on PP. I look forward to your advice and thank you in anticipation.
  5. Hi Larry, Found some more code which displays the button nicely but even though the yellow PayPal bar shows the link/hand icon it goes nowhere. I do have a developer id etc but don't know where to paste it. <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_blank"> <div id="smart-button-container" style="width: 60%; margin-left: 21%;"> <div style="text-align: left"><label class="checkout_form_mt_right v_align_top" for="description">Item:&nbsp;&nbsp;&nbsp;</label><input type="text" name="descriptionInput" id="description" size="40" value="Selected Jane Welsh Works of Art"></div> <p id="descriptionError" style="visibility: hidden; color:red; text-align: center;">Please enter a description</p> <div style="text-align: left"><label class="checkout_form_mt_right v_align_top" for="amount">Amount:&nbsp;&nbsp;</label><input name="amountInput" type="string" id="amount" value="$total"><span> AUD</span><span class='v_align_top white_text'><small><i>&nbsp;&nbsp;Australian dollars</i></small></span></div> <p id="priceLabelError" style="visibility: hidden; color:red; text-align: center;">Please enter a price</p> <div id="invoiceidDiv" style="text-align: center; display: none;"><label for="invoiceid"> </label><input name="invoiceid" maxlength="127" type="text" id="invoiceid" value="" ></div> <p id="invoiceidError" style="visibility: hidden; color:red; text-align: center;">Please enter an Invoice ID</p> <div style="text-align: center; margin-top: 0.625rem;" id="paypal-button-container"></div> </div> <!-- </form> --> I tried it with and without the closing form tag. There's also a heap of JavaScript which comes with this example from PayPal which I have not touched nor included here. Again, any advice will be most appreciated.
  6. Hi Larry, I am following your design in part 3 of the book to create a cart which is all fine - great guidance! But the website owner insists that the payment will be via PayPal (PP). I have looked at part 2 where you use PayPal but with fixed amounts. I am trying to create a button/link to PP for a variable amount and in Australian dollars. The code works fine as long as I do not try to change the currency. I also need to add 'thankyou' and 'cancel' links back to the website but I can't seem to do that either. I have Googled for hours without finding the solution. <!-- now the button --> <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_blank"> <input type="hidden" name="cmd" value="_cart"> <input type="hidden" name="business" value="xxxx@yyyy.com.au"> <input type="hidden" name="item_name" value="Item Description"> <input type="hidden" name="item_number" value=""> <input type="hidden" name="amount" value="$total"> <input type="hidden" name="handling" value="0.00"> <input type="hidden" name="shipping" value="0.00"> <!-- <input type="hidden" name="currency_code" value="AUD"> --> <input type="hidden" name="lc" value="AU"> <input type="hidden" name="bn" value="PP-BuyNowBF"> <input type="image" src="https://www.paypalobjects.com/en_AU/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_AU/i/scr/pixel.gif" width="1" height="1"> <input type="hidden" name="add" value="1"> </form> You can see that I have commented the currency out - with it 'in' I get an error from PP. Any guidance will be much appreciated. Best regards from Oz :-)
  7. Hi Nootkan, The issue that I am trying to help you with is the definition of the PHP variables whose names start with $color_ For example, unless $_POST['color'] == 'red') is true, the PHP variable $color_red will not get set. But you try and use it in the print statement whether it is defined or not. But you are better off following Larry's guidance and set just one $color variable. Cheers
  8. if the color is not red, then $color_red is not getting defined. You need something like: $color_red = ""; $color_yellow = ""; $color_green = ""; $color_blue = ""; Up front before you do the tests so that the variables are defined even if they are empty.
  9. Hi, You have a problem with the double quotes in your final print statement. Your first statement will end at the color:red unless you escape the double quotes around that style or use single quotes at that point. Cheers, Necuima
  10. OK, if you look in "browse" for the PHP6 book it is the latest post in that topic. Sorry, it is under my name.
  11. It looks like you have created the database but have you created the tables? Cheers, Necuima
  12. So glad that you got it to work for you. As mentioned, it has always worked flawlessly for me, both in my development environment and in production. Best wishes, Necuima
×
×
  • Create New...