External Form Data to a external action page

Permalink
Hey guys,

I been trying to look around where I can send data from an external form to a action page on another website. This will be a mail subscription where I need to send the user and email details and then redirect to a thank you page.

Any ideas how I can do this?

cheers,
Ritch

 
Saxafrass replied on at Permalink Reply
Won't it work to just have the action page's URL as your form's submit action?

<form id="my-form" name="my-form" method="post" action="http://myExternalURL.php">


Then tell myExternalURL to redirect to a thankyou page that's hidden from your root navigation.
roa123 replied on at Permalink Reply
Thanks for replying. I don't have any control over the action page that is hosted elsewhere, so it will most likely go to its own thank you page. I was more questioning whether i can pass this data over to a controller, and somehow send this data to that external action page in which I can then forward to my own thank you page.
CodeOtaku replied on at Permalink Best Answer Reply
CodeOtaku
Using PHP and CURL you can post data to an external script, let it do it's own thing, and then carry on with your own script on your server where it can send an email and whatever.

In C5, this code would be handled in a controller.

Expanding on this, all of the POST data from a form of your C5 site is available for processing in the page's controller script. And then it can return info. back to the main page about success/failure etc. for display to the user.

If you re-direct your page to the external page then you lose this control. You need to use CURL or AJAX, preferably CURL.
hereNT replied on at Permalink Reply
hereNT
Plus one on the CURL, though if you are using an external form you don't do it within the form's controller, you do it in the controller for the external form.

You could also do your processing on the form inputs, then do a submit to the external page if that's what you need to do. The external form will by default have an action back to that block's controller, then pass-through to the form controller. You should have access to $_POST there.
CodeOtaku replied on at Permalink Reply
CodeOtaku
I am new to C5 but good at PHP, yet I am wanting to do it the C5 way without taking training courses ;)
roa123 replied on at Permalink Reply
Thanks for the advice guys! Find it hard to believe no one has asked this question, or maybe this is considered an easy thing to do...
Tigere replied on at Permalink Reply
I too find it hard that this has not been clearly addressed, I'm still not getting how I can use my own external post url on C5 forms.