asXML() Problem
Posted
by ScroLL
on Stack Overflow
See other posts from Stack Overflow
or by ScroLL
Published on 2010-04-29T17:51:54Z
Indexed on
2010/04/29
18:07 UTC
Read the original article
Hit count: 256
Hello, I wrote this code to quickly edit an existing XML file and save changes to the file. However, it doesn't seem to be writing my data to the xml file. Am I using asXML() wrong? Thanks for your help.
<?php
$xml = simplexml_load_file("../xml/emp.xml");
$xml->employee[0]['empID'] = $_POST['empID'];
$xml->employee[0]->empFN = $_POST['first'];
$xml->employee[0]->empLN = $_POST['last'];
$xml->employee[0]->empDept['number'] = $_POST['num'];
$xml->employee[0]->empDept->empSup = $_POST['supv'];
$xml->employee[0]->emp_ext = $_POST['ext'];
$xml->employee[0]->k_plan = $_POST['plan'];
$xml->asXML();
header('Location: confirm_form.php');
?>
© Stack Overflow or respective owner