$compelem = $newconfigxml->createElement('competition'); $comp->write($compelem, $newconfigxml); $newdoc->appendChild($newconfigxml->createTextNode("\n\t")); $newdoc->appendChild($compelem); } // Work out whether the series are enabled foreach ($seriesbyid as $series) { // Looking for a request parameter called "series_xxx" if (array_key_exists("series_" . $series->id, $_REQUEST)) { $series->enabled = 'true'; } else { $series->enabled = 'false'; } // Now write out the series $serelem = $newconfigxml->createElement('series'); $series->write($serelem, $newconfigxml); $newdoc->appendChild($newconfigxml->createTextNode("\n\t")); $newdoc->appendChild($serelem); } $newconfigxml->save($tempconfigfilelocation); // Delete the old config file unlink($configfilelocation); rename($tempconfigfilelocation, $configfilelocation); } // Now we have all the available competitions and are going to output the form table ?> <form name="config" action="configuration.php" method="post"> <input id="save_button" type="submit" value="Save" disabled="disabled"/> <input type="hidden" name="ConfigurationChanges" value="Saved"/> <table> <?php