Not familiar with XML in PHP, but I think $fullname = $doc->createElement() should be $fullname = $root->createElement(). And the same for the other elements under the root.
–
Dutchie432Feb 14 '12 at 19:11

I need to know more about the original code. For example, the root of the XML schema should be "affiliates", not "affiliate". Where is the above PHP code called from? Your code is missing essential information to correcting your problem.
–
crushFeb 14 '12 at 19:35

The form is setup to email data and save data in a xml file. so $fname and $lname are capture information from the form. Again I have to iterate I am new to php. If company I work for was using asp.net hosting everything would be ok. I can post the form and all the php code if you would like.
–
PostonohFeb 14 '12 at 19:44

Is the XML document pre-existing, or is it always a newly created document?
–
crushFeb 14 '12 at 19:52