Results 1 to 2 of 2

Thread: simple xml update from php form

  1. #1
    Join Date
    Apr 2007
    Location
    Sydney, Aust - Downunder
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default simple xml update from php form

    Hey all,

    basically i have a little client list on a wiki that reads data from an xml file called db_staffList.xml eg:

    Code:
    <staff>
    <name><![CDATA[Adam Smith]]></name>
    <mobile>0420 111 222</mobile>
    <extension>4444</extension>
    <title>Executive Pimper</title>
    <email>adam.smith@company.com.au</email>
    </staff>
    and i am using xmlParser.php to do this and to display the results on a wiki page.

    That's all working a-ok, but i would like a non coding person to be able to update the db_staffList.xml with new items.

    to do this i would like to make a simple php form page that posts a new staff member into the xml file. All thats needed is 5 inputs and a submit btn eg:
    Code:
    <form name="input" action="insert.php" method="post">
        <p>Insert new client:</p>
        <input type="text" name="name" />
        <input type="text" name="mobile" />
        <input type="text" name="extension" />
        <input type="text" name="title" />
        <input type="text" name="email" />
        <input type="submit" value="send" />
    </form>
    can someone guide/help me in doing this im still very new to php. Validation isnt really required for the time being that can be phase 3.

  2. #2
    Join Date
    Sep 2008
    Posts
    56
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Default Re: - simple xml update from php form

    Hi,

    You can use to the file() function of PHP, which is for handling files. You can use this function to amend new data to the XML file.

    One thing that you will have to do will be i.e. the XML file should be given 777 permission so that it can be written by the PHP script.

    Hope this helps!

    Cheers,

    ~Maneet
    LeXolution IT Services
    Web Design Company

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •