I am using PHP curl to submit form post data to a external form on a different site, the problem is the form itself then posts to another form post data that I can't possiblely make up my self it sends the usually information but sends a savesql of the previous data, now is it possible to break down the savesql and send my save sql to the form?
You shouldn't be posting to the external form, but to the end location of the external form; I.E. check the <form> tag on the external page, get the location it is posting to and make sure that the fields you are posting to are all named correctly with the form elements on that page; You can also "automate" remote forms though using the Perl WWW::Mechanize implementation for PHP - I haven't used it, only the original Perl library but if it's an accurate clone it would be suitable for your needs. It's available at http://www.compasswebpublisher.com/php/www-mechanize-for-php
The problem is you can't post to the end location since it gets post data from the first post form that you can't get with out posting to the first. Get it? The 2nd post sends a input named savesql and it's in some encrypted format.
Right - so in that case you want to grab that information and pass it on to the second post - to a certain extent it's a form of screen scraping. Using the Mechanize library is ideal for that kind of work. It basically will allow you to make requests as if you are a webbrowser and you can automate the actions - so it would make the first post, gather the information you are looking for, and the you can continue on the next form. I've done this tons of times in the past with the Perl library and the PHP one looks very similar in functionality.
Check out http://www.compasswebpublisher.com/php/www-mechanize-for-php#forms which shows you how to use the script to login to a form (initial post) then it finds a link on that post's response and follows a link. You would modify that to submit the second form.
In cases like this, this is what I do... I use my trusty Firebug, and modify the action="xxxx.xxx" to point to a path on my server that just echoes out the variables for me. Then I get to see what's happening and whats being posted. If it's a double form (so to speak) then do the same thing on the second form and post it to a script to see it echo out the variables. Then from there you WILL know what's being posted back and can work with it from there.