I found many way but I can't use to remove the XML Element.This is my code.The code is people can input the date and then show in XML.But I don't know how to remove the element.
<html> <head> </head> <body> <form action="index.php" method="POST"> Name:<input type="text" name="name"/><br/> gender:<br>Male:<input type="radio" name="gender" value="male"/><br/> Female:<input type="radio" name="gender" value="female"/><br/> Birthday:<input type="text" name="Birthday"/><br/> Mobile phone number:<input type="tel" name="mobilephonenumber"/><br/> Email:<input type="email" name="email"/><br/> Home address:<textarea name="homeaddress" rows="5" cols="40"></textarea><br/> Other information:<textarea name="otherinformation" rows="5" cols="40"></textarea> <input type="submit" name="ok" value="add" /><br> <input type="submit" name="remove" value="remove your date you wrong input" /> </form> <?php if(isset($_POST['ok'])){ $xml= new DomDocument("1.0","UTF-8"); $xml->load("write.xml"); $rootTag=$xml->getElementsByTagName("document")->item(0); $dataTag=$xml->createElement("information"); $NameTag= $xml->createElement("name",$_POST['name']); $genderTag= $xml->createElement("gender",$_POST['gender']); $BirthdayTag= $xml->createElement("Birthday",$_POST['Birthday']); $mobilephonenumberTag= $xml->createElement("mobilephonenumber",$_POST['mobilephonenumber']); $emailTag= $xml->createElement("email",$_POST['email']); $homeaddressTag= $xml->createElement("homeaddress",$_POST['homeaddress']); $otherinformationTag= $xml->createElement("otherinformation",$_POST['otherinformation']); $dataTag->appendChild($NameTag); $dataTag->appendChild($genderTag); $dataTag->appendChild($BirthdayTag); $dataTag->appendChild($mobilephonenumberTag); $dataTag->appendChild($emailTag); $dataTag->appendChild($homeaddressTag); $dataTag->appendChild($otherinformationTag); $rootTag->appendChild($dataTag); $xml->formatOutput = true; $string_value=$xml->saveXML(); $xml->save("write.xml"); } ?> </body> </html> This page is I want to delete
<?php if(isset($_POST['clear'])){ } ?>
No comments:
Post a Comment