Jump to content

PHP form adds on XML


kvnmck18

Recommended Posts

Does anyone know how to make a form in PHP that would send the data that is entered in the fields to an XML (that has exisiting data) and creates and adds more data to the XML.So say if I had a form that had three inputs: 1. Title (<input name="title">) 2. Link (<input name="link">) 3. Description (<input name="des">)Then say these input fields were filled out to say: 1. The Blue Moon 2. http://www.blue.com 3. The Blue Moon is not really blue.That is then sent to existing file.xml and creates the following (that is added after previous data):(above here would be previous entries)<randomwriting><title>The Blue Moon</title><link>http://www.blue.com</link><description>The Blue Moon is not really blue.</description></randomwriting>And then also create another PHP form to open previous XML entries to edit or delete them.Any ideas? Any answers? If anyone knows it would be nice to post it because I'm sure it would help out a lot of people and save a lot of time.Thank you,KevinPM me if you have any questions and/or if you think you might have an answer.

Link to comment
Share on other sites

Check the php.net reference for XML functions:http://www.php.net/manual/en/ref.xml.phpYou will need to read the document in and parse it into a structure, add your new data to the structure, and then write the structure back to the xml document. There are probably some examples on the page that will help you out. If you can count on PHP 5 being present, you can use the more-powerful xmlreader and xmlwriter classes.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...