Paypal shopping basket link

Reply

Join Date: Aug 2004
Posts: 6
Reputation: huwgomez is an unknown quantity at this point 
Solved Threads: 0
huwgomez huwgomez is offline Offline
Newbie Poster

Paypal shopping basket link

 
0
  #1
Aug 2nd, 2004
Am new to SQL and PHP. Only been using them for about 3 weeks to create an e-commerce site for some friends. I have been trying to set up a link to paypal's shopping basket feature from my listing page. I'm trying to get the link to appear next to each row in my listing so that it extracts the rows values and sends them through to the shopping basket. Here is the script for the page:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- This site was created by Huw Hughes - huw_hughes712@hotmail.com -->
<HTML><HEAD>
<TITLE></title>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="website/Page1_files/page.css" rel=stylesheet>
<META content="Microsoft FrontPage 5.0" name=GENERATOR>
<META http-equiv=Last-Modified content=22/05/2004:08:35:13>
<META http-equiv=Pragma content=no-cache></HEAD>
<BODY>
<div align="center">
<center>
<table cellpadding="0" cellspacing="0" style="border-collapse: collapse; font-family:Arial Black; color:#FFFFFF; text-align:center" bordercolor="#000000" width="80%" id="AutoNumber1" bgcolor="#003163">
<tr>
<td width="100%" colspan="8" align="center" valign="top" height="1" bgcolor="#FFFFFF">
<img border="0" src="headlight_protectors_files/Alfa_romeo_Logo.jpg"></td>
</tr>
<tr>
<td width="100%" height="24" align="center" colspan="8" bgcolor="#000000">
<font face="Arial Black" size="4" color="#FFFFFF">Headlight Protectors</font></td>
</tr>
<tr>
<td width="12%" height="30" background="headlight_protectors_files/top_bg.jpg" align="center">
<font face="Arial Black" color="#FFFFFF">Part Number</font></td>
<td width="12%" height="30" background="headlight_protectors_files/top_bg.jpg" align="center">
<font face="Arial Black" color="#FFFFFF">Make</font></td>
<td width="12%" height="30" background="headlight_protectors_files/top_bg.jpg" align="center">
<font face="Arial Black" color="#FFFFFF">Model</font></td>
<td width="12%" height="30" background="headlight_protectors_files/top_bg.jpg" align="center">
<p align="center"><font face="Arial Black" color="#FFFFFF">Year Range</font></td>
<td width="23%" height="30" background="headlight_protectors_files/top_bg.jpg" align="center">
<font face="Arial Black" color="#FFFFFF">Description</font></td>
<td width="12%" height="30" background="headlight_protectors_files/top_bg.jpg" align="center">
<font face="Arial Black" color="#FFFFFF">Price</font></td>
<td width="12%" height="30" background="headlight_protectors_files/top_bg.jpg" align="center">
<font face="Arial Black" color="#FFFFFF">Shipping Cost</font></td>
<td width="5%" height="30" background="headlight_protectors_files/top_bg.jpg" align="center">
&nbsp;</td>
</tr>
<tr>
<?php
$db = mysql_connect("HOST_NAME","DB_NAME","DB_PASSWORD");
mysql_select_db("DB_NAME",$db);
$result = mysql_query("SELECT * FROM Items WHERE Category=35",$db);
while ($myrow = mysql_fetch_row($result)) (
printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n",
$myrow[0], $myrow[1], $myrow[2], $myrow[3], $myrow[4], $myrow[5], $myrow[7], $mysql[8]));
echo "</table>\n";
?>
</tr>
</table>
</div>
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="PAYPAL_ACCOUNT_USERNAME">
<input type="image" src="https://www.paypal.com/en_GB/i/btn/view_cart_02.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<input type="hidden" name="display" value="1">
</form>
<!-- This site was created by Huw Hughes - huw_hughes712@hotmail.com -->
<p>&nbsp;</p>
</BODY></HTML>


and here is the script for the paypal link:

<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="image" src="https://www.paypal.com/en_GB/i/btn/x-click-but22.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<input type="hidden" name="add" value="1">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="PAYPAL_ACCOUNT_USERNAME">
<input type="hidden" name="item_name" value="ITEM_NAME_FROM_DB">
<input type="hidden" name="item_number" value="ITEM_NUMBER_FROM_DB">
<input type="hidden" name="amount" value="COST_FROM_DB">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="GBP">
</form>

Please could someone help me with this as I have run out of ideas.

Thanks
Huw
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 19
Reputation: jt1 is an unknown quantity at this point 
Solved Threads: 3
jt1's Avatar
jt1 jt1 is offline Offline
Newbie Poster

Re: Paypal shopping basket link

 
0
  #2
Aug 31st, 2007
Hey Huw,

You'll need to do something like this:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- This site was created by Huw Hughes - huw_hughes712@hotmail.com -->
<HTML><HEAD>
<TITLE></title>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="website/Page1_files/page.css" rel=stylesheet>
<META content="Microsoft FrontPage 5.0" name=GENERATOR>
<META http-equiv=Last-Modified content=22/05/2004:08:35:13>
<META http-equiv=Pragma content=no-cache></HEAD>
<BODY>
<div align="center">
<center>
<table cellpadding="0" cellspacing="0" style="border-collapse: collapse; font-family:Arial Black; color:#FFFFFF; text-align:center" bordercolor="#000000" width="80%" id="AutoNumber1" bgcolor="#003163">
<tr>
<td width="100%" colspan="8" align="center" valign="top" height="1" bgcolor="#FFFFFF">
<img border="0" src="headlight_protectors_files/Alfa_romeo_Logo.jpg"></td>
</tr>
<tr>
<td width="100%" height="24" align="center" colspan="8" bgcolor="#000000">
<font face="Arial Black" size="4" color="#FFFFFF">Headlight Protectors</font></td>
</tr>
<tr>
<td width="12%" height="30" background="headlight_protectors_files/top_bg.jpg" align="center">
<font face="Arial Black" color="#FFFFFF">Part Number</font></td>
<td width="12%" height="30" background="headlight_protectors_files/top_bg.jpg" align="center">
<font face="Arial Black" color="#FFFFFF">Make</font></td>
<td width="12%" height="30" background="headlight_protectors_files/top_bg.jpg" align="center">
<font face="Arial Black" color="#FFFFFF">Model</font></td>
<td width="12%" height="30" background="headlight_protectors_files/top_bg.jpg" align="center">
<p align="center"><font face="Arial Black" color="#FFFFFF">Year Range</font></td>
<td width="23%" height="30" background="headlight_protectors_files/top_bg.jpg" align="center">
<font face="Arial Black" color="#FFFFFF">Description</font></td>
<td width="12%" height="30" background="headlight_protectors_files/top_bg.jpg" align="center">
<font face="Arial Black" color="#FFFFFF">Price</font></td>
<td width="12%" height="30" background="headlight_protectors_files/top_bg.jpg" align="center">
<font face="Arial Black" color="#FFFFFF">Shipping Cost</font></td>
<td width="5%" height="30" background="headlight_protectors_files/top_bg.jpg" align="center">
&nbsp;</td>
</tr>
<?php
$db = mysql_connect("HOST_NAME","DB_NAME","DB_PASSWORD");
mysql_select_db("DB_NAME",$db);
$result = mysql_query("SELECT * FROM Items WHERE Category=35",$db);
while ($myrow = mysql_fetch_row($result))
{
$paypal_code = '<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="image" src="https://www.paypal.com/en_GB/i/btn/x-click-but22.gif" border="0" name="submit" alt="Make payments with PayPal - it\'s fast, free and secure!">
<input type="hidden" name="add" value="1">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="PAYPAL_ACCOUNT_USERNAME">
<input type="hidden" name="item_name" value="'.$myrow[0].'">
<input type="hidden" name="item_number" value="'.$myrow[1].'">
<input type="hidden" name="amount" value="'.$myrow[2].'">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="GBP">
</form>';
printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n",
$myrow[0], $myrow[1], $myrow[2], $myrow[3], $myrow[4], $myrow[5], $myrow[7], $paypal_code));
}
?>
</table>
</div>
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="PAYPAL_ACCOUNT_USERNAME">
<input type="image" src="https://www.paypal.com/en_GB/i/btn/view_cart_02.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<input type="hidden" name="display" value="1">
</form>
<!-- This site was created by Huw Hughes - huw_hughes712@hotmail.com -->
<p>&nbsp;</p>
</BODY></HTML>
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 19
Reputation: jt1 is an unknown quantity at this point 
Solved Threads: 3
jt1's Avatar
jt1 jt1 is offline Offline
Newbie Poster

Re: Paypal shopping basket link

 
0
  #3
Aug 31st, 2007
It's also good practice to clean-up when you're finished with your MySQL results:

  1. @mysql_free_result($result);

This would go at the end of your while loop
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 4,483
Reputation: Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of 
Solved Threads: 515
Moderator
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Industrious Poster

Re: Paypal shopping basket link

 
0
  #4
Aug 31st, 2007
I'm sure Huw would have found this information very helpful - three years ago

Still, perhaps someone else will have a similar need and find it here now.
Last edited by Ezzaral; Aug 31st, 2007 at 2:12 pm.
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 19
Reputation: jt1 is an unknown quantity at this point 
Solved Threads: 3
jt1's Avatar
jt1 jt1 is offline Offline
Newbie Poster

Re: Paypal shopping basket link

 
0
  #5
Aug 31st, 2007
Hehe, sorry, my bad. I suppose that's what you get for answering at 3am on a Sunday morning.

You'll probably see a couple of others where I didn't read the date...

I'll apologise now in advance
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC