# PHP writing to XML

**URL:** <https://forum.kirupa.com/t/php-writing-to-xml/189864>\
**Category:** programming\
**Created:** [June 6, 2006, 8:06pm UTC](https://forum.kirupa.com/t/php-writing-to-xml/189864 "2006-06-06T20:06:13Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![simplistik](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/simplistik/32/7747_2.png) [@simplistik](https://forum.kirupa.com/u/simplistik)\
**Post date:** [June 6, 2006, 8:06pm UTC](https://forum.kirupa.com/t/php-writing-to-xml/189864/1 "2006-06-06T20:06:13Z")

</div>

So… I’ve scoured the internet and did a search on these forums… and perhaps I’m searching with the wrong terms… but here’s what I’m tryin to do. I have a PHP document that pull a list of images and info from specified XML docs. Now I’m trying to create a client-side GUI (just a basic form) that will allow someone add another node to an the XML document it’s pulling from.

**Oh and let it first be known that I don’t have the option to use a SQL Database… or any other type of Database… so XML is the best alternative.**

My XML is formatted like any other XML doc:

```auto

<images>

<image>
<group>GROUP NAME</group>
<filename>FILE NAME.JPG</filename>
<title>TITLE</title>
<published>06/05/06</published>
</image>

</images>

```

the attached gif I removed the file names and what not… for confidentiality 😛 but be assured that it does publish properly.

---

<div class="post-metadata">

**Author:** ![955](https://avatars.discourse-cdn.com/v4/letter/9/4bbf92/32.png) [@955](https://forum.kirupa.com/u/955)\
**Post date:** [June 6, 2006, 8:10pm UTC](https://forum.kirupa.com/t/php-writing-to-xml/189864/2 "2006-06-06T20:10:06Z")

</div>

> **[How can I edit an xml file through a php form?](https://www.kirupa.com/forum/showthread.php?t=51044&highlight=edit+xml)**
>
> Got a web design/development question or just want to hang out with the most awesome people on the planet? Drop on in!

Have you seen that thread?

---

<div class="post-metadata">

**Author:** ![bwh2](https://avatars.discourse-cdn.com/v4/letter/b/8c91f0/32.png) [@bwh2](https://forum.kirupa.com/u/bwh2)\
**Post date:** [June 6, 2006, 8:12pm UTC](https://forum.kirupa.com/t/php-writing-to-xml/189864/3 "2006-06-06T20:12:08Z")

</div>

so you want to append the file? check out the php page for [fwrite()](http://us2.php.net/fwrite) and do a find for “append”.

---

<div class="post-metadata">

**Author:** ![simplistik](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/simplistik/32/7747_2.png) [@simplistik](https://forum.kirupa.com/u/simplistik)\
**Post date:** [June 6, 2006, 8:14pm UTC](https://forum.kirupa.com/t/php-writing-to-xml/189864/4 "2006-06-06T20:14:31Z")

</div>

:lol: i just realized my stupid search function was on a 1wk timeframe…

@bwh2 yea, I knew about fwrite() but I need a physical example of how it works as I’m not a “developer” myself… I try to keep my nose outta it.

@λ is there a way to do that without using the attributes?

---

<div class="post-metadata">

**Author:** ![simplistik](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/simplistik/32/7747_2.png) [@simplistik](https://forum.kirupa.com/u/simplistik)\
**Post date:** [June 6, 2006, 8:22pm UTC](https://forum.kirupa.com/t/php-writing-to-xml/189864/5 "2006-06-06T20:22:17Z")

</div>

I think I may have figured it out… I’ll keep ya posted on my noobishness 😛

Thx fellas

---

<div class="post-metadata">

**Author:** ![simplistik](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/simplistik/32/7747_2.png) [@simplistik](https://forum.kirupa.com/u/simplistik)\
**Post date:** [June 6, 2006, 9:37pm UTC](https://forum.kirupa.com/t/php-writing-to-xml/189864/6 "2006-06-06T21:37:17Z")

</div>

Yea ok… so maybe I don’t have it figured out :lol: I did what I thought would need to be done and it doesn’t do what I thought it should do 😛 😉

---

<div class="post-metadata">

**Author:** ![JoshuaJonah](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joshuajonah/32/1775_2.png) [@JoshuaJonah](https://forum.kirupa.com/u/JoshuaJonah)\
**Post date:** [June 6, 2006, 9:40pm UTC](https://forum.kirupa.com/t/php-writing-to-xml/189864/7 "2006-06-06T21:40:36Z")

</div>

well, post more questions and maybe us code monkeys can help you. (just be easy on us in the critiques forums:D)

---

<div class="post-metadata">

**Author:** ![simplistik](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/simplistik/32/7747_2.png) [@simplistik](https://forum.kirupa.com/u/simplistik)\
**Post date:** [June 6, 2006, 9:48pm UTC](https://forum.kirupa.com/t/php-writing-to-xml/189864/8 "2006-06-06T21:48:34Z")

</div>

> [@Defective](#):
>
> well, post more questions and maybe us code monkeys can help you. (just be easy on us in the critiques forums:D)

:lol: well if one of you wants to jump on to MSN and hook a brotha up that’d be great… I tried to add you defective but you never accepted my invitation…

you can add me if you want though… it’s not the MSN in my profile though it’s [btp@mydomainname.com](mailto:btp@mydomainname.com) (mydomainname is my domain name 😛 not “mydomainname”)

---

<div class="post-metadata">

**Author:** ![bwh2](https://avatars.discourse-cdn.com/v4/letter/b/8c91f0/32.png) [@bwh2](https://forum.kirupa.com/u/bwh2)\
**Post date:** [June 6, 2006, 9:51pm UTC](https://forum.kirupa.com/t/php-writing-to-xml/189864/9 "2006-06-06T21:51:07Z")

</div>

[looks at defective’s footer, looks at simp’s posts, laughs heartily]. anyway, i’ll take a look at this stuff when i get home if you guys don’t already have it figured out.

---

<div class="post-metadata">

**Author:** ![simplistik](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/simplistik/32/7747_2.png) [@simplistik](https://forum.kirupa.com/u/simplistik)\
**Post date:** [June 6, 2006, 9:56pm UTC](https://forum.kirupa.com/t/php-writing-to-xml/189864/10 "2006-06-06T21:56:21Z")

</div>

> [@bwh2](#):
>
> [looks at defective’s footer, looks at simp’s posts, laughs heartily]. anyway, i’ll take a look at this stuff when i get home if you guys don’t already have it figured out.

:lol: yea, well I have no choice in the matter 😛 I’m against making things harder than what they should be :lol:

---

<div class="post-metadata">

**Author:** ![simplistik](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/simplistik/32/7747_2.png) [@simplistik](https://forum.kirupa.com/u/simplistik)\
**Post date:** [June 6, 2006, 10:10pm UTC](https://forum.kirupa.com/t/php-writing-to-xml/189864/11 "2006-06-06T22:10:54Z")

</div>

oh also… this has to be written in SAX not DOM :hugegrin:
