# Writing to XML using PHP

**URL:** <https://forum.kirupa.com/t/writing-to-xml-using-php/321678>\
**Category:** programming\
**Created:** [April 27, 2011, 9:59am UTC](https://forum.kirupa.com/t/writing-to-xml-using-php/321678 "2011-04-27T09:59:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![qakbar](https://avatars.discourse-cdn.com/v4/letter/q/ccd318/32.png) [@qakbar](https://forum.kirupa.com/u/qakbar)\
**Post date:** [April 27, 2011, 9:59am UTC](https://forum.kirupa.com/t/writing-to-xml-using-php/321678/1 "2011-04-27T09:59:37Z")

</div>

Hello,

I’m new to PHP and coding and would apprecaite the help.

Not sure if this is the right place to ask this question, but I wanted help to write to an XML file using PHP.

I want to add images using a form to an XML file without having to manually open the file on live server and adding them to the XML file.

for example:  
\<?xml version=“1.0” encoding=“utf-8”?\>  
\<Piecemaker\>  
\<Settings\>  
\<imageWidth\>900\</imageWidth\>  
\<imageHeight\>350\</imageHeight\>  
\<segments\>10\</segments\>  
\<tweenTime\>2.5\</tweenTime\>  
\<tweenDelay\>0.1\</tweenDelay\>

```
&lt;tweenType&gt;easeInOutBack&lt;/tweenType&gt;
&lt;zDistance&gt;100&lt;/zDistance&gt;
&lt;expand&gt;10&lt;/expand&gt;
&lt;innerColor&gt;0x111111&lt;/innerColor&gt;
&lt;textBackground&gt;0x333333&lt;/textBackground&gt;
&lt;shadowDarkness&gt;75&lt;/shadowDarkness&gt;

&lt;textDistance&gt;25&lt;/textDistance&gt;
&lt;autoplay&gt;5&lt;/autoplay&gt;

```

\</Settings\>

\<Image Filename=“images/3dslider/1.png”\>\</Image\>  
\<Image Filename=“images/3dslider/2.png”\>\</Image\>  
\<Image Filename=“images/3dslider/3.png”\>\</Image\>  
\<Image Filename=“images/3dslider/4.png”\>\</Image\>  
\<Image Filename=“images/3dslider/5.png”\>\</Image\>

\</Piecemaker\>

I was wondering if anyone has anything that will allow me to add the fields and change the setting using a form that will write to this xml file.

Thank you
