I have used the following code for submitting the values to paypal. but it is not working for firefox. Please give me a suggestion. -
// implied -- pbmods
-
echo '
-
<script language="javascript">
-
-
document.write("<form name=\"main_form1\" method=\"post\" action=\"'.PAYPAL_URL.'\">");
-
-
document.write("<input type=\"hidden\" name=\"cmd\" value=\"_cart\">");
-
-
document.write("<input type=\"hidden\" name=\"upload\" value=\"1\">");
-
-
document.write("<input type=\"hidden\" name=\"business\" value=\"'.$paypal_id.'\">");
-
document.write("<input type=\"hidden\" name=\"no_shipping\" value=\"1\">");
-
document.write("<input type=\"hidden\" name=\"currency_code\" value=\"USD\">");
-
-
-
document.write("<input type=\"hidden\" name=\"return\" value=\"'.NOTIFY_URL_SHOPPING.'\">");
-
-
document.write("<input type=\"hidden\" name=\"rm\" value=\"2\">");
-
-
document.write("<input type=\"hidden\" name=\"payer_id\" value=\"'.$payer_session.'\">");
-
-
document.write("<input type=\"hidden\" name=\"first_name\" value=\"'.$sfirstName.'\">");
-
document.write("<input type=\"hidden\" name=\"last_name\" value=\"'.$slastName.'\">");
-
document.write("<input type=\"hidden\" name=\"address1\" value=\"'.$sstreet.'\">");
-
document.write("<input type=\"hidden\" name=\"city\" value=\"'.$scity.'\">");';
-
-
if($scountry == "1")
-
{ $state_for_paypal = trim($state_for_paypal);
-
$paypal_content.='document.write("<input type=\"hidden\" name=\"state\" value=\"'.$state_for_paypal.'\">");
-
document.write("<input type=\"hidden\" name=\"country\" value=\"US\">");';
-
}
-
else
-
{
-
$sprovince = trim($sprovince);
-
$paypal_content.='document.write("<input type=\"hidden\" name=\"state\" value=\"'.$sprovince.'\">");
-
document.write("<input type=\"hidden\" name=\"country\" value=\"CA\">");';
-
}
-
$paypal_content.='
-
document.write("<input type=\"hidden\" name=\"zip\" value=\"'.$zipcode.'\">");
-
document.write("<input type=\"hidden\" name=\"mobile\" value=\"'.$mobile.'\">");
-
document.write("<input type=\"hidden\" name=\"email\" value=\"'.$email.'\">");';
-
-
-
$sno=1;
-
$shipping_cost=0;
-
$totamt=0;
-
-
$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";
-
$result_sales_details = mysql_query($select_sales_details,$dbconnection1);
-
while(list($Product_id,$Price,$Quantity,$Shipping_cost,$Product_name,$Item_No)=mysql_fetch_array($result_sales_details))
-
{
-
$paypal_content .='
-
document.write("<input type=\"hidden\" name=\"item_name_'.$sno.'\" value=\"'.$Product_name.'\">");
-
document.write("<input type=\"hidden\" name=\"item_number_'.$sno.'\" value=\"'.$Item_No.'\">");
-
document.write("<input type=\"hidden\" name=\"amount_'.$sno.'\" value=\"'.$Price.'\">");
-
document.write("<input type=\"hidden\" name=\"quantity_'.$sno.'\" value=\"'.$Quantity.'\">");
-
document.write("<input type=\"hidden\" name=\"shipping_'.$sno.'\" value=\"'.$Shipping_cost.'\">");';
-
-
$sno++;
-
$totamt +=($Price*$Quantity);
-
$shipping_cost += $Shipping_cost;
-
}
-
-
$ord_tot = $totamt;
-
$tax = ($ord_tot*$sales_tax)/100;
-
$ord_tot = $ord_tot+$tax+$shipping_cost;
-
$tax=number_format($tax,2,'.','');
-
$shipping_cost=number_format($shipping_cost,2,'.','');
-
$ord_tot=number_format($ord_tot,2,'.','');
-
-
$paypal_content .=
-
'
-
document.write("<input type=\"hidden\" name=\"shipping\" value=\"'.$shipping_cost.'\">");
-
document.write("<input type=\"hidden\" name=\"tax_cart\" value=\"'.$tax.'\">");
-
document.write("<input type=\"hidden\" name=\"tot_amt\" value=\"'.$ord_tot.'\">");
-
document.write("<input type=\"hidden\" name=\"custom\" value=\"'.$payer_session.'~~~'.$memberid.'~~~'.$first_name.'~~~'.$last_name.'~~~'.$email.'~~~'.$username.'~~~'.$time.'~~~'.$order_no.'~~~'.$store_id.'~~~'.$tax.'\">");
-
document.write("<input type=\"hidden\" name=\"night_phone_a\" value=\"'.$phone1.'\">");
-
document.write("<input type=\"hidden\" name=\"night_phone_b\" value=\"'.$phone2.'\">");
-
document.write("<input type=\"hidden\" name=\"night_phone_c\" value=\"'.$phone3.'\">");
-
document.write("</form>");
-
-
-
document.main_form1.action="'.PAYPAL_URL.'";
-
document.main_form1.submit();
-
-
</script>';
-
echo $paypal_content;
[Please use CODE tags when posting source code. Thanks! --pbmods] 7 1542
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?
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">
First suggestion: stop using javascript to dynamically build your page. That is what PHP is there for.
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
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.
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
Heya, munnaj.
Glad to hear you got it working! Good luck with your project, and if you ever need anything, post back anytime :)
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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,...
|
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...
|
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...
|
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...
|
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...
|
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....
|
by: Nicodemus |
last post by:
Do You Belive?
\
cheapbbc@sina.com wrote in news:aecf26b6-4c75-4d87-b09c-a7380875e0f3
@w34g2000prm.googlegroups.com:
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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,...
| |