//print_r($_POST); //GET ALL THE FORM SUBMITTED VALUES $datafieldtag = $_POST['datafieldtag']; $ind1 = $_POST['ind1']; $ind2 = $_POST['ind2']; if (isset($_POST['_count_subfields-multiple_fields'])) { $count = $_POST['_count_subfields-multiple_fields']; } else { $count = 0; } foreach ($fields as $key => $val) { $xml_output = get_Datastream($val, $marcID); $xml_output_dc = get_Datastream($val, $dcID); $handle = retrieveHandle($xml_output_dc, $dictionary['HandleNamespace']); $xmlA = new simpleXMLElement($xml_output); $namespace = $xmlA->getDocNamespaces(true); $temp = $xmlA->children($namespace['default'])->addChild('datafield'); $temp->addAttribute('tag', $datafieldtag); $temp->addAttribute('ind1', $ind1); $temp->addAttribute('ind2', $ind2); $tempTest = $temp->addChild('subfield', $_POST['subfieldValue']); $tempTest->addAttribute('code', $_POST['subfieldCode']); for ($i = 1; $i <= $count; $i++) { $tempValue = "subfieldValue_" . $i; $tempCode = "subfieldCode_" . $i; $tempTest = $temp->addChild('subfield', $_POST[$tempValue]); $tempTest->addAttribute('code', $_POST[$tempCode]); } $marcTest = $xmlA->saveXML(); $marcxml = simplexml_load_string($marcTest); $agent = new Agent();