} } /* CURL process */ $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // allow redirects curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_URL, 'http://crm.orionondemand.com/crm/InquiryFormRuntime.sas'); //THIS STAYS THE SAME curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json', 'Content-Type: application/json')); //prepare the field values being posted to the service $data = array('formValues' => array('Contacts' => array(), 'Cases' => array()), 'filesUploaded' => array(), 'deleteAttachments' => array(), 'inquiryFormId' => $formid, 'messageType' => 'submit', 'seed' => $seed, 'formId' => $formid); foreach ($postArray as $key => $val) { $iw_formfield_name = iw_fieldmap_name($db, $key); if (!$iw_formfield_name) { $iw_formfield_name = $key; } // if the field was found in the DB, grab the value and plunk it into the translated var name if (stristr($iw_formfield_name, "Contacts")) { $iw_formfield_name = str_replace("Contacts.", "", $iw_formfield_name); $thisfieldvalue = $postArray[$key]; $data['formValues']['Contacts'][$iw_formfield_name] = $thisfieldvalue; } else { if (stristr($iw_formfield_name, "Cases")) { $iw_formfield_name = str_replace("Cases.", "", $iw_formfield_name); $thisfieldvalue = $postArray[$key]; $data['formValues']['Cases'][$iw_formfield_name] = $thisfieldvalue; } }
<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/form-defines.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/formatting-functions.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/form-functions.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/DB.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/define-connect.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/admission/includes/iw-fields/functions.php"; $db = new DB(HOST, USER, PASSWORD, DATABASE); $db->connect(); $fetchFields = array('fname', 'lname'); $fields = array(); $fname = "Testname"; $lname = "TestLast"; foreach ($fetchFields as $field) { // $fields[$field]['iw_formfield_name'] = $k; // $fields[$field]['iw_post_varname'] = $v; $iw_formfield_name = iw_fieldmap_name($db, $field); $thisfieldvalue = ${$field}; echo "<input type=\"text\" name=\"{$iw_formfield_name}\" value=\"{$thisfieldvalue}\" />"; }