Mar 11th, 2010, 1:48 PM
(Mar 11th, 2010, 8:55 AM)xcrunner529 Wrote: Hi. i'd like to do the same thing. 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?
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? Thanks!
Hi, I'm still working my way through the mods that Ben made - but all appears well. Ben's solution was
Quote:The issue was that after first arriving at the page, the form ID was available in the GET variable, but after posting the form back to itself, the form ID was lost. I just tweaked it a bit to pass it hidden in a form field, and got the code to pull the form ID out of EITHER $_POST or $_GET. That circumvented the problem.
The key bits of code being
PHP Code:
// a simple trick to combine $_POST and $_GET, so that the $form_id is always found in a single
// variable, whether or not it was passed through the query string or a hidden form field
$request = array_merge($_POST, $_GET);
$form_id = isset($request["form_id"]) ? $request["form_id"] : "";
and
PHP Code:
<input type="hidden" name="form_id" value="<?php echo $form_id; ?>" />
Regarding your question about whether you have to pass the form_id in via the url - I think the answer is yes. Otherwise won't you lose reference to the form_id?