Processing forms
Permalink
I would like to submit a form to C5 and have the controller take some of the data received from the form and send it as a form to a second server.
maybe it could be done from the page, send two forms simultaneously one to the C5 server and the other two an external server,
Anyone have a suggestion on this?
thanks
maybe it could be done from the page, send two forms simultaneously one to the C5 server and the other two an external server,
Anyone have a suggestion on this?
thanks
1) If you're sending the same data that was posted to the first page along to the second page, take a look at this technique:
http://www.velocityreviews.com/forums/showpost.php?p=3823114&po...
Your controller would receive the first request, do what it needs to do, then use that 307 redirect to send the form data along to the second page. Make sure you call "exit" after the redirect so Concrete5 doesn't try to output anything before the redirect takes place.
2) Depending on how much data there is, you could use a normal redirect and put the data into the querystring for the second request (so it would show up in $_GET, not $_POST). But there is a character limit to these querystrings in the url, so this might not work if there's a lot of data or it's a variable amount (like a bunch of text that the user entered into a textarea field).
3) You can have the controller send the data for the second request using CURL -- so the server itself is POSTing data to the second server (as opposed to telling the browser to redirect there). This has the limitation of not being able to send the user to that second server, so depending on your situation it might not work.
That's all I can think of. Good luck!