$val) { $index = $key + 1; $fullpath[$key] = $options['bricklink'.$index]; } $imagespath = $options['imagespath']; $pbrickimg = $imagespath.$options['pbrickimg']; $upbrickimg = $imagespath.$options['upbrickimg']; if (isset($_POST['xmledited'])) { //here we reformat the form data into XML... $new_xml = new SimpleXMLElement(""); foreach ($_POST as $key=>$val) { if (strpos($key,"id_")!==false) { $item = $new_xml->AddChild('item'); $item->AddAttribute('id',$val); $item->AddAttribute('product_name',$_POST['product_'.$count]); $item->AddAttribute('link_brick',$_POST['link_'.$count]); $item->AddAttribute('type',$_POST['type_'.$count]); $item->AddAttribute('top',$_POST['top_'.$count]); $item->AddAttribute('left',$_POST['left_'.$count]); $item->AddAttribute('width',$_POST['width_'.$count]); $item->AddAttribute('height',$_POST['height_'.$count]); if ($count==0) { $item->AddAttribute('raised',$_POST['total']); } $count++; } // end if statement } // end foreach statement //aaaand, write to XML file in specified location $new_xml->asXML($_SERVER{'DOCUMENT_ROOT'}.$file); ?>

message; } } foreach ($xml->item as $item) { if (isset($item['raised'])) { $xml_raised = $item['raised']; } $xml_tops[] = $item['top']; $xml_lefts[] = $item['left']; $xml_widths[] = $item['width']; $xml_heights[] = $item['height']; $xml_ids[] = $item['id']; $xml_products[] = $item['product_name']; $xml_links[] = $item['link_brick']; $xml_bricks[] = $item['type']; }// end foreach } else { ?>

Brick #:Donor/Message:Brick Amount:Purchased?TopLeftWidthHeight
'; echo '

'; echo ''; // this loop displays XML arrays as form inputs foreach ($xml_ids as $key=>$val) { echo '

'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '

'; } //end foreach statement // Output the total raised so far on the last line of the form if (isset($xml_raised)) { echo '

Total Raised so far:

'; } echo '

'; echo '
'; echo ''; ?>