I'm making an interface-website to update a concert-list on a band-website. The list is stored as an XML file an has this structure :
I already wrote a script that enables me to add a new gig to the list, this was relatively easy... Now I want to write a script that enables me to edit a certain gig in the list. Every Gig is Unique because of the first attribute : "id" . I want to use this reference to edit the other attributes in that Node.
My PHP is very poor, so I hope someone could put me on the good foot here...
My PHP script :
<?php
$id = $_POST['id'];
$day = $_POST['day'];
$month = $_POST['month'];
$year = $_POST['year'];
$venue = $_POST['venue'];
$xml_file="gig.xml";
$fh = fopen($xml_file,'r');
$current_tag=" ";
function start_element($parser,$element_name,$element_attrs)
{
$current_tag = $element_name;
if($element_name == 'GIG' && $element_attrs["ID"] == $id)
{
echo 'gig ID =' . $id;
// here the new info has to replace the old
};
};
if($fh) {
echo "&verify=success&";
} else {
echo "&verify=fail&";
}
fclose($fh);
?>