Redirect plugin w/ MailChimp form - $_POST not going through

pthesis 28 Mar, 2010
First of all, congrats on an excellent extension. It took me no time to get Joomla registration working along with integrating the registration form with CBE.

The problem I'm having now is that I'm using the redirect plugin to pass the $_POST data to an article page which has a form in it via an embedded module. I see the debug message on the top of the second page with all the correct $_POST variables carrying through, but for some reason that data doesn't get passed to (or doesn't get picked up by) the module on the same page. When I run a print_r($_POST) within the module I receive an empty array.

If it matters, the code in the embedded module is for a MailChimp sign-up form, and on its own it works fine. I only need the First name, Last name, and E-mail variables from the sign-up form to be made available to this form.

I hope this makes sense. Does anyone have any suggestions on what I can do to solve this?

Thanks a lot.
pthesis 28 Mar, 2010
Instead of $_POST I tried using the following code from another forum:

<?php
$session  =& JFactory::getSession();
$posted = $session->get('chrono_formpages_data', array(), md5('chrono'));
?>


But that didn't work either. print_r($posted) returns an empty array within the MailChimp form module.
nml375 28 Mar, 2010
Hi,
The very nature of HTTP Redirects prohibit the use of POST-style data. You could still embed data in the URL (GET-style) however. You'll set this up in the General Tab of the plugin setup. Keep in mind that the script at the redirect URL needs to fetch the data "GET-style", not "POST-style".

The session storage is only used by ChronoForms if you are using the MultiPage plugin. You could add some similar code to manually add the data to the session storage however, using the set method. Proper care to cleanup the storage once the form is redirected would be recommended.

/Fredrik
pthesis 28 Mar, 2010
Thanks Fredrik. I'll see what I can do with the options I have.
nml375 28 Mar, 2010
Hi,
I'm not sure this is an option in your case, but the cURL CF-plugin does support "POST-style" data, though it's done behind the scenes (the remote user will never see this HTTP-transaction).

/Fredrik
pthesis 28 Mar, 2010
Fredrik,

Would you know how I can embed the data I need passed through GET style? Once it makes it through I know how to access it from within the module.

The URL I'm redirecting to is: index.php?option=com_content&view=article&id=222&Itemid=551.


Thanks.
nml375 28 Mar, 2010
Hi,
Yes, on the "General Tab" of the CF-plugin setup, you'll find one field for each form field of your form; here you enter the name of the "new" field. The additional, static, values are added to the textarea below those. For the ones you've listed, it should look like this:
option=com_content
view=article
id=222
Itemid=551


/Fredrik
pthesis 28 Mar, 2010
Fredrik,

Would you mind elaborating on how I can use the CURL plugin for this? I can't change the form method from POST to GET because it's doing a bunch of things, including Joomla registration, file upload, and DB connection.


Thanks.
nml375 28 Mar, 2010
Sure,
You set it up pretty much like you do with the Redirect-plugin. The one difference is that you've got both before and after "extra code" options (php-code to be executed just before and right after the curl-operation).

The response from the curl-operation is available in the "extra after CURL code" as $response, should you need to process it.

/Fredrik
GreyHead 29 Mar, 2010
Hi pthesis,

Just to chip in. Don't try to submit to the MailChimp form elsewhere on your site, Check the MailChimp API (or just the form settings) and submit directly to MailChimp).

AS Fredrik says the cURL plugin is the way to go as this submits the data to MailChimp but keeps the user on your site.

Bob
This topic is locked and no more replies can be posted.