XML Value edit
Posted: Tue Mar 25, 2008 5:35 am
Hello Friends,
any one know how we can edit xml value with php???
any one know how we can edit xml value with php???
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
I'm not seeing much effort come from your direction. Have you tried anything yet? Anything you got stuck on? If we think you're trying and you demonstrate that you're at least trying then maybe we'll offer more help. What did you think of the article Rovas linked to?geniuscapri wrote:again here.![]()
i have 3 input fields UserName: CountryName: Age:
i want to insert this out put data in XML. it should be multiple data.
and after adding i also want to edit them or delete.
any one can help me about it???
This is a experiment
Code: Select all
<users_acounts>
<user_info>
<username>asdfasd</username>
<password>fasd</password>
<firstname>fasdf</firstname>
<lastname></lastname>
<email></email>
<mail_stop></mail_stop>
<phone></phone>
<permission>
<readonly>no</readonly>
<img_manager>no</img_manager>
<doc_share>no</doc_share>
<CPX>no</CPX>
</permission>
</user_info>
<user_info>
<username>fhjfgjhfg</username>
<password>jhfgjhfg</password>
<firstname>jhfgjhfghj</firstname>
<lastname></lastname>
<email></email>
<mail_stop></mail_stop>
<phone></phone>
<permission>
<readonly>no</readonly>
<img_manager>no</img_manager>
<doc_share>no</doc_share>
<CPX>no</CPX>
</permission>
</user_info>
</users_acounts>
Code: Select all
<?php
$file = 'testFile.xml';
if (file_exists($file)) {
// load file
$xml = simplexml_load_file($file) or die ("Unable to load XML file!");
$userinfo_tag=$xml->user_info;
foreach($userinfo_tag as $userinfo_tag2)
{
$xml = simplexml_load_file($file) or die ("Unable to load XML file!");
$username_tag=$userinfo_tag2->username;
foreach($username_tag as $un_value)
{
echo $un_value;
} ?>Code: Select all
<a href="user_edit.php?userinfo=<?php echo $userinfo_tag2;?>">Edit</a>