Gurus out there... PLEASE HELP!!!!
I am trying to create a form on my page which can list the parent nodes of an XML file, and based upon the user's selection, then delete that node and save the resulting document.
So far, I have managed to load the contents of the XML file into the form and list the parent nodes as a dropdown list.
Now, what I want to do is have the user select the element from that list that they no longer want, then when they click the "Remove" button, have that element (and all its children elements) removed from the XML file and the resulting file saved.
This is what I have so far:
$objDOM = new DOMDocument();
$objDOM->load("myfile.xml"); //make sure path is correct
$polys = $objDOM->getElementsByTagName("drawnpolys");
Then the form goes as follows:
<form name="main" action="<?php echo $_SERVER['PHP_SELF']?>" method="post">
<select name="SelectPoly">
<option value="">------- SELECT -------</option>
<?php foreach( $polys as $value ) { ?>
<option value="<?php echo ($value->getAttribute('name')); ?>"><?php echo ($value->getAttribute("name")); ?></option>
<?php } ?>
</select>
<input type="submit" name="Remove_Polys_From_List" value="Remove Polygons From List" />
</form>
And now I am getting stuck with the bit of php code to remove the selected polygon...
So far all I have is the basic:
if (isset($_POST['Remove_Polys_From_List'])){
}
What do I put in that if statement to do this??
PLEASE HELP!!!!