How to add data in xml file using php?

I was trying to insert new data into an existing XML file, but it's not working. Here's my xml file:


    swimming
    running

Now, my idea was making two files: an index page, where it displays what's on the file and provides a field for inserting new elements, and a php page which will insert the data into the XML file. Here's the code for index.php:


test





    insert activity:
    
    


Chủ Đề