Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $doc = new DOMDocument();
- $doc->load( 'things.xml' );
- $doc->formatOutput = true;
- if( $_POST['clear'] ){
- $thingset = $doc->getElementsByTagName("thingset")->item(0);
- $new = $doc->createElement('thingset');
- $doc->documentElement->replaceChild($new, $thingset);
- }else{
- $thing = $doc->createElement('thing');
- $text = $doc->createTextNode(htmlentities($_POST['thing']));
- $thing->appendChild($text);
- $doc->getElementsByTagName("thingset")->item(0)->appendChild($thing);
- }
- $doc->save( 'things.xml' );
- header( 'Location: things.php' );
- ?>
Add Comment
Please, Sign In to add comment