I've got an html form that submits via AJAX (jquery Form Plugin) to a PHP Web Proxy on my server. The web proxy uses curl to POST to a third party script.
My html form has inputs with names like p[fname], p[lname], c[name], p[loc], p[loc][email], p[loc][email][detail]. The names are specified by the third party application.
When I use GET to submit the form to the web proxy, I can simply do the following to transmit the form data successfully to the third party script inside a curl request:
$postvars = $_SERVER['QUERY_STRING'];
curl_setopt ($session, CURLOPT_POSTFIELDS, $postvars);
Question #1: Is there anything 'wrong' with using GET to submit the form data to my web proxy? As I mentioned, it works fine, and requires less coding. $_SERVER['QUERY_STRING'] has exactly the data I need to pass to the third party via POST, in exactly the correct format.
Question #2: If there is a compelling reason to use POST to submit to my web proxy, what's the best way to loop through the multidimensional associative array in $_POST in order to build $postvars dynamically, without having to hard code any key values?
Note: The html form is not mission-critical and the data submitted by it goes into an approval cue in the third party service. It's not inserted directly into the production data.