Page 1 of 1

XML Value edit

Posted: Tue Mar 25, 2008 5:35 am
by geniuscapri
Hello Friends,
any one know how we can edit xml value with php???

Re: XML Value edit

Posted: Tue Mar 25, 2008 7:49 am
by Rovas
You should read about XPath and PHP' s SimpleXML to edit XML using PHP. For a first step read this itutorial

Re: XML Value edit

Posted: Wed Mar 26, 2008 2:46 am
by geniuscapri
again here. :banghead:
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 :cry:

Re: XML Value edit

Posted: Wed Mar 26, 2008 3:56 am
by Chris Corbyn
geniuscapri wrote:again here. :banghead:
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 :cry:
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?

Re: XML Value edit

Posted: Wed Mar 26, 2008 4:50 am
by geniuscapri
no i have not tried any thing yet.
i am here just for looking any example script.

Re: XML Value edit

Posted: Wed Mar 26, 2008 5:26 am
by geniuscapri
no any reply :banghead:

Re: XML Value edit

Posted: Wed Mar 26, 2008 7:07 am
by Rovas
You got the wrong idea nobody will offer you a script to do what you need. Read the rules: You put the code we help you fix it if it can be fixed.

Re: XML Value edit

Posted: Wed Mar 26, 2008 8:29 am
by geniuscapri
This is My XML Code!

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>
 
and This is my PHP Code

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;
}   ?>
every thing is working. now want to edit any some values who's between <user_info> </ user_info> tags.
now start my problem :cry:
i am going to send user_info as ref to another page for edit my xml data.
i am doing this with.

Code: Select all

<a href="user_edit.php?userinfo=<?php echo $userinfo_tag2;?>">Edit</a>
But $userinfo_tag2 is not going to my next page.
now Rovas can you help me??? :drunk:

Re: XML Value edit

Posted: Wed Mar 26, 2008 9:26 am
by geniuscapri
again no reply :banghead:

Re: XML Value edit

Posted: Thu Mar 27, 2008 12:11 am
by geniuscapri
no any reply :cry: