deleting and orginizing xml data with php
Alright so first off I need to warn you guys that I am a complete noob when it comes to coding. I've been learning how to do it from the internet for about a month now. I do not understand php very well, but I don't really want to, I just need to get something done.
Anyway right now I have a html page which displays 7 links. When you click on a link it will load an associated xml file in an iframe, which is styled by an xsl file, into a sortable table. I use a jquery plugin to sort the data. I also have a <div> below the table which contains a form which is used to update the original xml with new data using a php file (I am using uniServer to run the php files on my computer).
Since there are 7 links in the original html page, there are 7 different xml files, 7 different xsl files (each of these contain an html table and form), and 7 different php files.
Sorry if that was confusing.
So far everything works good, but there are 2 things I would like to do that I cannot seem to figure out myself or find any info (that I can understand) on the internet.
1. When I add data to an xml file using the form it comes out like
I want it to look like this
This way it would be much more easily readable and easier to edit in the future.
2. I would like to create a way to delete xml data (for example: something that would delete a certain <backup> tag and all the, tags and associated data, within that <backup> tag)
I'm am not sure of the best way to do this, that isn't overly complicated. I was thinking maybe I could just make another form that would have the user input a value for one of the tags that I would choose (not all the tags have unique values, but in all of the 7 links there is at least one tag that does. That tag would be the one I would require the user to enter). Then a php file would delete the tag which contained a matching value to what was entered in the form. all sibling tags with their associated values would be deleted as well as the parent tag (<backup> in this case).
This seems a little sloppy though and the user would have to enter the value exactly. So is there a better way to do this? And if there isn't, could someone help me with the php coding.
I really have no idea how php works. The only way I was able to make the xml file update was by searching the internet, copying what someone else had posted about doing the same thing, and then changing the tag names to be what I needed. Unfortunately I can't find anything on deleting data :(
thanks for any help in advance, and Sorry if this was confusing.