I'm having a problem with deleting an element that contains a childNodes->value with a $variable == $_POST['id'].
I've searched and found where you can get the content of a childNodes but nothing about deleting it's parent.
Does anybody know where I could look?
I've tried piecing together functions from http://www.php.net but nothing is exactly what I'm looking for.
Needing guidance not so much the code (though not going to bock at it).
(example help: Check out a specific tutorial or try using blah, blah, blah functions)
Any help would be great.
Thanks a ton,
sky
OH, here's what I'm trying as of now:
Code: Select all
$toDelete = $_POST['id'];
$home = $dom->documentElement;
$house = $home->getElementsByTagName('house');
// collects all the "house" elements in my rootNode "home"
$id = $house->getElementsByTagName('id');
// collects all "id" elements in $house variable
if($id == $toDelete){
//$id = $home->remove_child('$home');
echo "id is the answer";
}else if($houseOne == $toDelete){
echo "houseOne is the answer";
}else if($house == $toDelete){
echo "house is the answer";
}else{
echo "These are not the answers";
}Code: Select all
<home>
<house>Tom's House</house>
<id>1234</id>
</house>
</home>