I have a CGI script written in C that processes data posted to it. It then redirects to a page known by the CGI script, but not to the form that submits to it (the CGI figures out the result location).
When I post to the CGI script using an HTML form, it works correctly. The problem comes when, instead of posting to the CGI, I post to an error-checking script written in PHP. When the data has been validated, I use a PHP script to post the data to the CGI. This should be the same as posting to the CGI from a form, but it's not.
When I post to the CGI program using a PHP script instead of an HTML form, I get an intermediate page which, instead of transparently redirecting, says: "302 Found: The document has moved here" where "here" is a link to where it should have automatically redirected. The user is forced to click, which I do not want.
Can someone enlighten me as to why the "Location" header works correctly when a form posts to the CGI, but not when a PHP script posts to it?? Any insight you can give me would be greatly appreciated!!
Alternatively, I could find a way to communicate back to my PHP script the result code the CGI generates and do the redirect there, but I can't figure out how to do that, either.