PayPal

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
DraftBoards
Forum Newbie
Posts: 6
Joined: Thu May 22, 2008 3:30 pm

PayPal

Post by DraftBoards »

I am trying to add paypal on my website. Below is the code I'm using. I'm getting an error on the line marked with an * below. Anyone know what I'm doing wrong?

Code: Select all

 
          <?php
          
          $Selected=$_POST["Boardsize"];
          
          if ($Selected=="1"){
              $Name="3 x 6 Bad Ass Draft Board";
              $Number="#001";
              $Value="$39.95";
        } else if ($Selected=="2"){
              $Name="4 x 8 Bad Ass Draft Board";
              $Number="#002";
              $Value="$44.95";
        }
                    
echo '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">'
* echo '<input type="hidden" name="cmd" value="_xclick">'  
echo '<input type="hidden" name="business" value="webmaster@badassdraftboards.com">'
echo '<input type="hidden" name="item_name" value="3 x 6 Bad Ass Draft Board">'
echo '<input type="hidden" name="item_number" value="#001">'
echo '<input type="hidden" name="amount" value="39.95">'
echo '<input type="hidden" name="no_shipping" value="0">'
echo '<input type="hidden" name="no_note" value="1">'
echo '<input type="hidden" name="currency_code" value="USD">'
echo '<input type="hidden" name="weight" value="2">'
echo '<input type="hidden" name="weight_unit" value="lbs">'
echo '<input type="hidden" name="lc" value="US">'
echo '<input type="hidden" name="bn" value="PP-BuyNowBF">'
echo '<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">'
echo '<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">'
echo '</form>'
 
 
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: PayPal

Post by Christopher »

What's the error? Have you tried things like:

https://www.paypal.com/us/cgi-bin/websc ... lp_outside
(#10850)
DraftBoards
Forum Newbie
Posts: 6
Joined: Thu May 22, 2008 3:30 pm

Re: PayPal

Post by DraftBoards »

Parse error: syntax error, unexpected T_ECHO, expecting ',' or ';' in /home/a230432/public_html/Checkout.php on line 179.

I looked at the paypal page you sent, but I have more than 2 options that I am trying to handle. It seems the code I have should be easy to fix, but I'm fairly new to php.

Thanks for your help.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: PayPal

Post by Christopher »

You need semicolons at the end of every line. ;)
(#10850)
DraftBoards
Forum Newbie
Posts: 6
Joined: Thu May 22, 2008 3:30 pm

Re: PayPal

Post by DraftBoards »

I knew it was something simple. Thanks again for your help.
Post Reply