Inserting data in XML file with PHP DOM

后端 未结 6 1536
南旧
南旧 2020-12-18 06:03

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


    swimming         


        
6条回答
  •  悲哀的现实
    2020-12-18 06:45

    is your code block copy and pasted from your existing files? if so i see two potential issues:

    // should be:

    note: you're missing action="insert.php", which would cause the form to just reload itself without submitting, which is the behaviour you describe.

    secondly, make sure you have write permission to "sample.xml". you can confirm if you're actually writing anything:

    print 'I wrote '.$xmldoc->save('sample.xml').' bytes of data';
    

提交回复
热议问题