# XSLT edit XML with PHP (need help!)

**URL:** <https://forum.kirupa.com/t/xslt-edit-xml-with-php-need-help/288131>\
**Category:** programming\
**Created:** [May 11, 2009, 5:43pm UTC](https://forum.kirupa.com/t/xslt-edit-xml-with-php-need-help/288131 "2009-05-11T17:43:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![unvoid](https://avatars.discourse-cdn.com/v4/letter/u/e36b37/32.png) [@unvoid](https://forum.kirupa.com/u/unvoid)\
**Post date:** [May 11, 2009, 5:43pm UTC](https://forum.kirupa.com/t/xslt-edit-xml-with-php-need-help/288131/1 "2009-05-11T17:43:48Z")

</div>

So I was finally able to find what I wanted to online today but the process is in ASP [http://www.w3schools.com/Xsl/xsl\_editxml.asp](http://www.w3schools.com/Xsl/xsl_editxml.asp).

I want to be able to do that but in php. I already have my xml and xsl files ready to go but I cannot for the life of my figure out how to edit the forms and update the xml.

I was able to read the xml file and output it using some DOM functions but I can’t seem to figure out how to edit multiple random fields and save them using php. Any ideas?

Here is what I have:

```auto
            $rfile = $eid;
            $freader = fopen($rfile, 'r') or die("Can't open read file");
            $theData = fread($freader, filesize($rfile));
            fclose($freader);
            
            // Load XML file
            $XML = new DOMDocument();
            $XML->loadXML( $theData );
            
            // Start xslt
            $xslt = new XSLTProcessor();
            $XSL = new DOMDocument();
            $XSL->load( $XSLpath, LIBXML_NOCDATA);
            $xslt->importStylesheet( $XSL );
            
            // Print 
            print $xslt->transformToXML( $XML ); 

```
