# Writing an attribute in 5.2.4 for a newb

**URL:** <https://forum.kirupa.com/t/writing-an-attribute-in-5-2-4-for-a-newb/243671>\
**Category:** programming\
**Created:** [November 9, 2007, 2:28pm UTC](https://forum.kirupa.com/t/writing-an-attribute-in-5-2-4-for-a-newb/243671 "2007-11-09T14:28:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![fathed](https://avatars.discourse-cdn.com/v4/letter/f/b5ac83/32.png) [@fathed](https://forum.kirupa.com/u/fathed)\
**Post date:** [November 9, 2007, 2:28pm UTC](https://forum.kirupa.com/t/writing-an-attribute-in-5-2-4-for-a-newb/243671/1 "2007-11-09T14:28:53Z")

</div>

I am a newb with PHP, I admit.

I am writing an XML file with PHP from user input forms. I have it writing the file perfectly. What I want to do now is add an attribute to my nodes. How do I write that\>

I have tried :

```php

 $module = $modules->appendChild($dom->addAttribute('type', 'reprints'));

```

and it doesn’t work.

Everything else is great but this and I can’t find anything that works online. Any help would be greatly appreciated.

thank you.
