I am working on this system where a user logs in and can enter data into a HTML form and then recieve a credit report, bankruptcy report, etc..

Background:
I created a system where the data is passed through the $_POST function into a hidden form field where posted data would go in between XML tags. like <name-first>$_Post['$fname'].......</name-first>... etc...
This worked in theory, but the data is posted to another server that contains these reports and the result returned was in XML format..


On to the problem
I have resorted to using the cURL function based on a tutorial I found (http://www.phpfreaks.com/tutorials/49/1.php)

but in the tutorial, the data was in XML. I cannot get the code to work in sending a XML query to the server and having the server return the report (in any format) without going to the actual XML page.

here is my code:


PHP Code:
 <?
switch($_REQUEST['cmd']){
    default:
        include 
'prop_form.php';
    break;
    
    case 
"post":
$postfields = array();
$postfields[] = array("<userid>USER</userid>");  
$postfields[] = array("<password>PASS </password>");   
$postfields[] = array("<name-first>"$_POST['$fname'],"</name-first>");
$postfields[] = array("<name-last>"$_POST['$lname'],"</name-last>");
$postfields[] = array("<dob>"$_POST['$year']);  
$postfields[] = array($_POST['$month']);  
$postfields[] = array($_POST['$day'],"</dob>");  
       
        foreach(
$postfields as $subarray) {
             list(
$foo$bar) = $subarray;
             
$bar urlencode($bar);
             
$postedfields[]  = "$foo=$bar";
        }
        
        
$urlstring join("\n"$postedfields);
        
$urlstring ereg_replace("\n""&"$urlstring);
        
// echo $urlstring;
        
        
$ch curl_init("https://xml.securint.com/services/test");
        
curl_setopt($chCURLOPT_HEADER0);
        
curl_setopt($chCURLOPT_POST1);
        
curl_setopt($chCURLOPT_POSTFIELDS$urlstring);
        
curl_setopt($chCURLOPT_FOLLOWLOCATION0);
        
curl_setopt($chCURLOPT_REFERER"http://www.hmscredit.com/");
        
curl_setopt($chCURLOPT_RETURNTRANSFER1);
        
$data curl_exec($ch);
        
curl_close($ch);
        
        
$response_start strPos($data"Server Response:");
        
$response_end strPos($data"\n");
        
$temp_code substr($data$response_start, ($response_end $response_start));
        
$temp_code str_replace("Server Response:"""$temp_code);
        
$temp_code strip_tags($temp_code);
        
$transaction_code trim($temp_code);
        
        switch(
$transaction_code){
            case 
"Transaction Success!":
                
//redirect person to thank you page
                
echo "Success!!!!!!!!";
                echo 
$data;
            break;
            
            default:
                echo 
'<font color="red">Transaction Error: '.$transaction_code.'</font>';
                include 
'form.html';
            break;
        }
    break;
}

?>

I also considering scratching the array and making the query a variable and using the $_Post[' thedata'] method but no luck with that either.

any ideas?