Jul 24th, 2011, 9:03 AM
OK, so the first thing I did was modify my code to include your code like so:
This gets me:
Then changed the code to this:
and got nothing. Email never arrived with the parameters but if I remove the exit; and if $pay is set to cheque, I can process the form and submit it and it bypasses the paypal connection and simply submits it as a normal non-paypal form. However, it does not show me my thank you page. It just shows me a blank page with my "mode is live" echo. Try it and my explanation might be clearer.
Thanks Ben,
Dave
Code:
<?php
$pay = "cheque";
$curr_folder = dirname(__FILE__);
require_once("$curr_folder/includes/library.02.php");
$fields = ft_api_init_form_page($pp["form_id"], $pp["mode"]);
if ($pp["mode"] == "initialize")
{
$params = array(
"submit_button" => "submit",
"next_page" => "success.php",
"form_data" => $_POST,
"finalize" => true
);
}
elseif ($pp["mode"] == "live")
{
echo "mode is live";
if($pay=="cheque") {
$params = array(
"submit_button" => "submit",
"next_page" => "/events/entry-thanks.php",
"form_data" => $_POST,
"file_data" => $_FILES,
"finalize" => true
);
print_r($params);
exit;
}
elseif($pay=="paypal") {
$params = array(
"submit_button" => "submit",
"next_page" => "paypal-submit.php",
"form_data" => $_POST,
"file_data" => $_FILES
);
}
}
ft_api_process_form($params);
?>
Code:
mode is live Array ( [submit_button] => submit [next_page] => /events/entry-thanks.php [form_data] => Array ( ) [file_data] => Array ( ) [finalize] => 1 )
Then changed the code to this:
Code:
<?php
$pay = "cheque";
$curr_folder = dirname(__FILE__);
require_once("$curr_folder/includes/library.02.php");
$fields = ft_api_init_form_page($pp["form_id"], $pp["mode"]);
if ($pp["mode"] == "initialize")
{
$params = array(
"submit_button" => "submit",
"next_page" => "success.php",
"form_data" => $_POST,
"finalize" => true
);
}
elseif ($pp["mode"] == "live")
{
echo "mode is live\n";
if($pay=="cheque") {
$params = array(
"submit_button" => "submit",
"next_page" => "/events/entry-thanks.php",
"form_data" => $_POST,
"file_data" => $_FILES,
"finalize" => true
);
}
elseif($pay=="paypal") {
$params = array(
"submit_button" => "submit",
"next_page" => "paypal-submit.php",
"form_data" => $_POST,
"file_data" => $_FILES
);
}
}
$content = array();
while (list($key, $value) = each($params))
$content .= "$key: $value\n";
mail("myemail@mydomain.net", "debugging!", $content);
exit;
ft_api_process_form($params);
?>
and got nothing. Email never arrived with the parameters but if I remove the exit; and if $pay is set to cheque, I can process the form and submit it and it bypasses the paypal connection and simply submits it as a normal non-paypal form. However, it does not show me my thank you page. It just shows me a blank page with my "mode is live" echo. Try it and my explanation might be clearer.
Thanks Ben,
Dave
(Jul 23rd, 2011, 11:13 PM)Ben Wrote: Yeah - very possibly! But let's check it out just to make sure. Right before the ft_api_process_form line, add the following, then reload the page.
PHP Code:print_r($params);
exit;
ft_api_process_form($params);
I really want to see what info is being passed to the function... From the original error, it sounds like that var simply doesn't have the right content.
Oh, daft of me: if you're testing all this with the function being called via ipn by PayPal, email it to yourself instead (since you won't see the page being loaded);
PHP Code:$content = array();
while (list($key, $value) = each($params))
$content .= "$key: $value\n";
mail("your@email.com", "debugging!", $content);
exit;
ft_api_process_form($params);
Let me know how it goes.
- Ben