Hey guys,
Sorry for the wait! To recap:
The simplest way is to pass the form ID via the query string, but there are other options - a couple of which I'll explain below.
You can't just send the form ID to the PayPal processing page because it's needed at the very start. The moment the user first arrives on the form page, the API function (ft_api_init_form_page()) does some work behind the scenes to store space in sessions for this particular session. It requires the form ID to work - that's basically the long and short of it.
So the problem is, since it needs to know right off the bat what the form ID is that we're interested in we have to tell it somehow. Passing it via the query string is a quick and easy solution to get around it.
But here's a couple of other options:
1. POST the form ID to the page instead of passing it via the query string. Whenever you link to the page, put the form_id in a form post, probably a hidden field.
This obviously isn't great. But at least the query string would be empty.
2. Instead of passing the form ID, pass in a descriptive string instead, e.g.
form.php?page=ApplicationForm
form.php?page=RegistrationForm
form.php?page=MyContactForm
(or whatever).
Then, in the PHP at the very top of your page, map those strings to a form ID, like this:
($request is a variable mentioned by Martin in a previous post. It's a the $_POST and $_GET hashes squished together).
And that's pretty much it.
Any help at all...?
- Ben
Sorry for the wait! To recap:
Quote:I really don't want form_id added to any front-end links if at all possible, couldn't I just store in in a php variable in the form code?Agreed! It would be nice to avoid.
Quote:By reading this am I correct that I'd have to link to the forms themselves with the ?form_id= appended or could I just send the formid from the form to the paypal processing page?
The simplest way is to pass the form ID via the query string, but there are other options - a couple of which I'll explain below.
You can't just send the form ID to the PayPal processing page because it's needed at the very start. The moment the user first arrives on the form page, the API function (ft_api_init_form_page()) does some work behind the scenes to store space in sessions for this particular session. It requires the form ID to work - that's basically the long and short of it.
So the problem is, since it needs to know right off the bat what the form ID is that we're interested in we have to tell it somehow. Passing it via the query string is a quick and easy solution to get around it.
But here's a couple of other options:
1. POST the form ID to the page instead of passing it via the query string. Whenever you link to the page, put the form_id in a form post, probably a hidden field.
This obviously isn't great. But at least the query string would be empty.
2. Instead of passing the form ID, pass in a descriptive string instead, e.g.
form.php?page=ApplicationForm
form.php?page=RegistrationForm
form.php?page=MyContactForm
(or whatever).
Then, in the PHP at the very top of your page, map those strings to a form ID, like this:
PHP Code:
$map = array(
"ApplicationForm" => 1,
"RegistrationForm" => 2,
"MyContactForm" => 3
);
$default_form_id = 1; // just in case!
$form_id = (isset($map[$request["page"]])) ? $map[$request["page"]] : $default_form_id;
($request is a variable mentioned by Martin in a previous post. It's a the $_POST and $_GET hashes squished together).
And that's pretty much it.
Any help at all...?
- Ben