473,396 Members | 2,089 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Paypal in firefox using PHP

6
I have used the following code for submitting the values to paypal. but it is not working for firefox. Please give me a suggestion.
Expand|Select|Wrap|Line Numbers
  1. // implied -- pbmods
  2. echo '
  3. <script language="javascript">
  4.  
  5. document.write("<form name=\"main_form1\" method=\"post\"  action=\"'.PAYPAL_URL.'\">");
  6.  
  7. document.write("<input type=\"hidden\" name=\"cmd\" value=\"_cart\">");
  8.  
  9. document.write("<input type=\"hidden\" name=\"upload\" value=\"1\">");
  10.  
  11. document.write("<input type=\"hidden\" name=\"business\" value=\"'.$paypal_id.'\">");
  12. document.write("<input type=\"hidden\" name=\"no_shipping\" value=\"1\">");
  13. document.write("<input type=\"hidden\" name=\"currency_code\" value=\"USD\">");
  14.  
  15.  
  16. document.write("<input type=\"hidden\" name=\"return\" value=\"'.NOTIFY_URL_SHOPPING.'\">");
  17.  
  18. document.write("<input type=\"hidden\" name=\"rm\" value=\"2\">");
  19.  
  20. document.write("<input type=\"hidden\" name=\"payer_id\" value=\"'.$payer_session.'\">");
  21.  
  22. document.write("<input type=\"hidden\" name=\"first_name\" value=\"'.$sfirstName.'\">");
  23. document.write("<input type=\"hidden\" name=\"last_name\" value=\"'.$slastName.'\">");
  24. document.write("<input type=\"hidden\" name=\"address1\"  value=\"'.$sstreet.'\">");
  25. document.write("<input type=\"hidden\" name=\"city\"  value=\"'.$scity.'\">");';
  26.  
  27. if($scountry == "1")
  28. {    $state_for_paypal = trim($state_for_paypal);
  29.     $paypal_content.='document.write("<input type=\"hidden\" name=\"state\"  value=\"'.$state_for_paypal.'\">");
  30.     document.write("<input type=\"hidden\" name=\"country\"  value=\"US\">");';
  31. }
  32. else
  33. {
  34.     $sprovince = trim($sprovince);
  35.     $paypal_content.='document.write("<input type=\"hidden\" name=\"state\"  value=\"'.$sprovince.'\">");
  36.     document.write("<input type=\"hidden\" name=\"country\"  value=\"CA\">");';
  37. }
  38. $paypal_content.='
  39. document.write("<input type=\"hidden\" name=\"zip\"  value=\"'.$zipcode.'\">");
  40. document.write("<input type=\"hidden\" name=\"mobile\"  value=\"'.$mobile.'\">");
  41. document.write("<input type=\"hidden\" name=\"email\" value=\"'.$email.'\">");';
  42.  
  43.  
  44. $sno=1;
  45. $shipping_cost=0;
  46. $totamt=0;
  47.  
  48. $select_sales_details = "Select S.Product_id, S.Price, S.Quantity, S.Shipping_cost, P.Product_name, P.Item_No from ".TEMP_SALES." as S, ".PRODUCTS." as P Where S.Order_no='$order_no' and S.Product_id=P.Product_id";
  49. $result_sales_details = mysql_query($select_sales_details,$dbconnection1);
  50. while(list($Product_id,$Price,$Quantity,$Shipping_cost,$Product_name,$Item_No)=mysql_fetch_array($result_sales_details))
  51.     {
  52.     $paypal_content .='
  53.                 document.write("<input type=\"hidden\" name=\"item_name_'.$sno.'\" value=\"'.$Product_name.'\">");
  54.                 document.write("<input type=\"hidden\" name=\"item_number_'.$sno.'\" value=\"'.$Item_No.'\">");
  55.                 document.write("<input type=\"hidden\" name=\"amount_'.$sno.'\" value=\"'.$Price.'\">");
  56.                 document.write("<input type=\"hidden\" name=\"quantity_'.$sno.'\" value=\"'.$Quantity.'\">");
  57.                 document.write("<input type=\"hidden\" name=\"shipping_'.$sno.'\" value=\"'.$Shipping_cost.'\">");';
  58.  
  59.         $sno++;
  60.         $totamt +=($Price*$Quantity);
  61.         $shipping_cost += $Shipping_cost;
  62.     }
  63.  
  64. $ord_tot = $totamt;
  65. $tax = ($ord_tot*$sales_tax)/100;
  66. $ord_tot = $ord_tot+$tax+$shipping_cost;
  67. $tax=number_format($tax,2,'.','');
  68. $shipping_cost=number_format($shipping_cost,2,'.','');
  69. $ord_tot=number_format($ord_tot,2,'.','');
  70.  
  71. $paypal_content .=
  72.     '
  73.         document.write("<input type=\"hidden\" name=\"shipping\" value=\"'.$shipping_cost.'\">");
  74.         document.write("<input type=\"hidden\" name=\"tax_cart\" value=\"'.$tax.'\">");
  75.         document.write("<input type=\"hidden\" name=\"tot_amt\" value=\"'.$ord_tot.'\">");
  76.         document.write("<input type=\"hidden\" name=\"custom\" value=\"'.$payer_session.'~~~'.$memberid.'~~~'.$first_name.'~~~'.$last_name.'~~~'.$email.'~~~'.$username.'~~~'.$time.'~~~'.$order_no.'~~~'.$store_id.'~~~'.$tax.'\">");
  77.         document.write("<input type=\"hidden\" name=\"night_phone_a\" value=\"'.$phone1.'\">");
  78.         document.write("<input type=\"hidden\" name=\"night_phone_b\" value=\"'.$phone2.'\">");
  79.         document.write("<input type=\"hidden\" name=\"night_phone_c\" value=\"'.$phone3.'\">");
  80.         document.write("</form>");
  81.  
  82.  
  83.         document.main_form1.action="'.PAYPAL_URL.'";
  84.         document.main_form1.submit();
  85.  
  86.         </script>';
  87. echo $paypal_content;
[Please use CODE tags when posting source code. Thanks! --pbmods]
Jul 12 '07 #1
7 1542
pbmods
5,821 Expert 4TB
Heya, munnaj. Welcome to TSDN!

If it's working in one browser but not another, then the problem is in the Javascript.

What JavaScript errors is your code generating?
Jul 12 '07 #2
drhowarddrfine
7,435 Expert 4TB
Let's start with the only thing I can probably help with. This is invalid:
<script language="javascript">

Replace it with this:
<script type="text/javascript">
Jul 12 '07 #3
Motoma
3,237 Expert 2GB
First suggestion: stop using javascript to dynamically build your page. That is what PHP is there for.
Jul 12 '07 #4
munnaj
6
Heya, munnaj. Welcome to TSDN!

If it's working in one browser but not another, then the problem is in the Javascript.

What JavaScript errors is your code generating?
hai,

Thanks for your reply. This is the error am getting from the Error console on firefox
Error: document.main_form1 has no properties
Source File: http://ang.gwg.com/scripts/topaypal_shopping_cart.php?mode=guest&id=36&sessio nid=130fc897de7f37ccc1abf9172894f2c7&store_id=0&or der_no=a9233&sales_tax=10.00
Line: 45
Jul 14 '07 #5
pbmods
5,821 Expert 4TB
Heya, munnaj.

Yeah. You're going to want to completely rewrite your PHP so that you're outputting HTML instead of JavaScript, as Motoma suggested.
Jul 14 '07 #6
munnaj
6
Heya, munnaj.

Yeah. You're going to want to completely rewrite your PHP so that you're outputting HTML instead of JavaScript, as Motoma suggested.

Thank You all....

I juz included a form with submit option using PHP and it is working fine.
Thanks for your suggestions
Jul 14 '07 #7
pbmods
5,821 Expert 4TB
Heya, munnaj.

Glad to hear you got it working! Good luck with your project, and if you ever need anything, post back anytime :)
Jul 14 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Stephane | last post by:
Hi, I'm trying to use PayPal and its Instant Payment Notification. In short, when a payment is made, PayPal send a post to my server and I post it back to PayPal. I'm using WebRequest to do...
2
by: Tommy | last post by:
I have written some code to use paypal for users to make purchases from my site. I am using the paypal instant payment notification. When i get the notification from paypal I send the user an...
7
by: Alan Silver | last post by:
Hello, I've just been looking at the free PayPal component from ComponentOne and am somewhat amazed how insecure it is. They include all the transaction details in plain text in the querystring,...
5
by: Jason James | last post by:
Guys, it seems that several people have enquired about how to communicate with Paypal as securely as possible. It is obvious that placing the shopping cart details in the URL is about as...
3
by: Yourself | last post by:
Hi, I'm trying to post data to PayPal for a shopping cart, basically I want to replicate a form like the following, but create the variables dynamically from code behind: <form...
0
tolkienarda
by: tolkienarda | last post by:
hi all most of you have seen this form, mostly it has hidden attributes some of which can be changed to select boxes. the part that seems to be a security flaw is that people can edit live html...
0
by: PayPal Security Measures! | last post by:
<P><A href="http://www.paypal.com/cgi-bin/webscr?cmd=_home" target=_blank><IMG src="https://www.paypal.com/en_US/i/logo/paypal_logo.gif" border=0></A</P> <TABLE cellSpacing=0 cellPadding=0...
1
by: MehtabKhan | last post by:
Any one who tell me what’s wrong with this code. When I pass values to pay pal by using www.sandbox.paypal.com/cgi-bin/webscr all the code are working well. The orders are generating accurately....
0
by: Nicodemus | last post by:
Do You Belive? \ cheapbbc@sina.com wrote in news:aecf26b6-4c75-4d87-b09c-a7380875e0f3 @w34g2000prm.googlegroups.com:
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.