Posts: 114
Threads: 42
Joined: Jan 2010
Reputation:
0
I am creating a PayPal payment form and have been following the paypla form tutorial. I have been stumped by, what appears to be a very silly error. Every time I add the code to use the included library.php file, it stops the php on the page from rendering. See the attached image.
I have the following code, which all looks OK. (note that there is more code after this snippet but it renders fine, as long as I do not have the formtools code in there. I also have to keep the formtools code in ints own php block ... otherwise, the rest of the code will not render either.
PHP Code: <?php
//$curr_folder = dirname(__FILE__); require_once("../conference/includes/library.php");
$fields = ft_api_init_form_page($pp["form_id"], $pp["mode"]);
if ($pp["mode"] == "initialize") { $params = array( "submit_button" => "submit", "next_page" => "thanks.php", "form_data" => $_POST, "finalize" => true ); } else { $params = array( "submit_button" => "submit", "next_page" => "paypal_submit.php", "form_data" => $_POST ); } ft_api_process_form($params);
?>
Really appreciate if you could have a look at this as I need to get this live by tomorrow AM.
Dave
Posts: 114
Threads: 42
Joined: Jan 2010
Reputation:
0
Ben,
OK .. I have figured out what was wrong with the way I was adding the PHP Code: action="<?php echo $_SERVER["PHP_SELF"]?>"
I have also verified that the library item is being called and that the $$pp(array) is available in my form page. I have also verified that the initialize mode is being called but the form will not redirect to my thanks.php page when I click the PayPal button. I have also verified that the name of the Paypal button is "submit" and that the name has been properly added to the api code at the top of my page. However, when I click the PayPal button, all it does is output all the $_POST variables to the top of my page
Now, the only thing I can think of is that there is something in the way that I am putting this form together that is interfering with the proper execution. There are three files involved in this page. There is file1.php, which basically houses some JavaScript functions and the form code (built dynamically). This file also calls file2.php, which has some php functions and also calls the html template I use to place the form into. So perhaps the separate require_once calls are stopping the api from functioning?
Dave
(Apr 11th, 2010, 2:29 PM)filch Wrote: I am creating a PayPal payment form and have been following the paypla form tutorial. I have been stumped by, what appears to be a very silly error. Every time I add the code to use the included library.php file, it stops the php on the page from rendering. See the attached image.
I have the following code, which all looks OK. (note that there is more code after this snippet but it renders fine, as long as I do not have the formtools code in there. I also have to keep the formtools code in ints own php block ... otherwise, the rest of the code will not render either.
PHP Code: <?php
//$curr_folder = dirname(__FILE__); require_once("../conference/includes/library.php");
$fields = ft_api_init_form_page($pp["form_id"], $pp["mode"]);
if ($pp["mode"] == "initialize") { $params = array( "submit_button" => "submit", "next_page" => "thanks.php", "form_data" => $_POST, "finalize" => true ); } else { $params = array( "submit_button" => "submit", "next_page" => "paypal_submit.php", "form_data" => $_POST ); } ft_api_process_form($params);
?>
Really appreciate if you could have a look at this as I need to get this live by tomorrow AM.
Dave
Posts: 114
Threads: 42
Joined: Jan 2010
Reputation:
0
OK ... well I am beyond frustrated with trying to get this form working with PayPal. I have either become suddenly stupid (possible) or I am missing something obvious ... or it simply will not work. Because I am assuming that something in the way I have constructed this form, I have now decided on a different approach. I am pointing the first part of the form to a second page with a form on it and populating hidden fields in that form with the data from the first, thus allowing the user to confirm before submitting. I am trying to add the code from the PayPal tutorial on the site so it is on this second form that I am adding the links to the library and conf files. I have set this up as a multipage form in Formtools but perhaps I should be treating it as a single page form? At any rate, even though it is properly calling the library files and I can echo out the proper form id and mode ... the damn thing will not initialize.
I really could use a second or third pair of eyes on this before I go MAD!
Any help would be really appreciated.
Dave
Posts: 63
Threads: 9
Joined: Nov 2009
Reputation:
0
Hi Dave,
Having recently worked through the Paypal stuff, I can sympathise!
Just a thought, would it be easier (possible even?) to confirm before submitting to Paypal i.e. just use the second page? That might simplify the whole process for you.
I'm only guessing, but I'd bet that the form is being thrown because of the first page.
Martin
(Apr 12th, 2010, 1:28 PM)filch Wrote: OK ... well I am beyond frustrated with trying to get this form working with PayPal. I have either become suddenly stupid (possible) or I am missing something obvious ... or it simply will not work. Because I am assuming that something in the way I have constructed this form, I have now decided on a different approach. I am pointing the first part of the form to a second page with a form on it and populating hidden fields in that form with the data from the first, thus allowing the user to confirm before submitting. I am trying to add the code from the PayPal tutorial on the site so it is on this second form that I am adding the links to the library and conf files. I have set this up as a multipage form in Formtools but perhaps I should be treating it as a single page form? At any rate, even though it is properly calling the library files and I can echo out the proper form id and mode ... the damn thing will not initialize.
I really could use a second or third pair of eyes on this before I go MAD!
Any help would be really appreciated.
Dave
Posts: 114
Threads: 42
Joined: Jan 2010
Reputation:
0
Well, the problem with that is that if you send a confirmation to the client BEFORE the payment has been cleared ... and then ... it does not clear, you are hooped. You pretty well have to get the confirmation back after Paypal. So, you must depend on PP to get this info back to you. I have used IPN in the past but it does not seem to be working the way it is supposed to with formtools. I am now using the files from the Paypal tutorial, which includes a file to forward the submission on to PP and the IPN script to make sure everything went well. But this time ... it does not seem to work. This is the first time I have tried using formtools with PayPal.
Dave
(Apr 15th, 2010, 12:53 PM)martin_undefined Wrote: Hi Dave,
Having recently worked through the Paypal stuff, I can sympathise!
Just a thought, would it be easier (possible even?) to confirm before submitting to Paypal i.e. just use the second page? That might simplify the whole process for you.
I'm only guessing, but I'd bet that the form is being thrown because of the first page.
Martin
(Apr 12th, 2010, 1:28 PM)filch Wrote: OK ... well I am beyond frustrated with trying to get this form working with PayPal. I have either become suddenly stupid (possible) or I am missing something obvious ... or it simply will not work. Because I am assuming that something in the way I have constructed this form, I have now decided on a different approach. I am pointing the first part of the form to a second page with a form on it and populating hidden fields in that form with the data from the first, thus allowing the user to confirm before submitting. I am trying to add the code from the PayPal tutorial on the site so it is on this second form that I am adding the links to the library and conf files. I have set this up as a multipage form in Formtools but perhaps I should be treating it as a single page form? At any rate, even though it is properly calling the library files and I can echo out the proper form id and mode ... the damn thing will not initialize.
I really could use a second or third pair of eyes on this before I go MAD!
Any help would be really appreciated.
Dave
|