XML Value edit

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
geniuscapri
Forum Newbie
Posts: 7
Joined: Tue Mar 25, 2008 5:31 am

XML Value edit

Post by geniuscapri »

Hello Friends,
any one know how we can edit xml value with php???
Rovas
Forum Contributor
Posts: 272
Joined: Mon Aug 21, 2006 7:09 am
Location: Romania

Re: XML Value edit

Post by Rovas »

You should read about XPath and PHP' s SimpleXML to edit XML using PHP. For a first step read this itutorial
geniuscapri
Forum Newbie
Posts: 7
Joined: Tue Mar 25, 2008 5:31 am

Re: XML Value edit

Post 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:
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: XML Value edit

Post 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?
geniuscapri
Forum Newbie
Posts: 7
Joined: Tue Mar 25, 2008 5:31 am

Re: XML Value edit

Post by geniuscapri »

no i have not tried any thing yet.
i am here just for looking any example script.
geniuscapri
Forum Newbie
Posts: 7
Joined: Tue Mar 25, 2008 5:31 am

Re: XML Value edit

Post by geniuscapri »

no any reply :banghead:
Rovas
Forum Contributor
Posts: 272
Joined: Mon Aug 21, 2006 7:09 am
Location: Romania

Re: XML Value edit

Post 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.
geniuscapri
Forum Newbie
Posts: 7
Joined: Tue Mar 25, 2008 5:31 am

Re: XML Value edit

Post 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:
geniuscapri
Forum Newbie
Posts: 7
Joined: Tue Mar 25, 2008 5:31 am

Re: XML Value edit

Post by geniuscapri »

again no reply :banghead:
geniuscapri
Forum Newbie
Posts: 7
Joined: Tue Mar 25, 2008 5:31 am

Re: XML Value edit

Post by geniuscapri »

no any reply :cry:
Post Reply