473,386 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

New to PHP: Need to update an xml file with html & php

Hi Guys & Gals:

I have a project with using flash that is updated with an xml file. The developer went belly up and is no longer assisting with anything. I need to write a simple html or php form to update and possibly edit current items in the xml file.


Here is my current xml file:
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="UTF-8"?><sports>
  2.  
  3. <sport id="6" game="Softball" gameStatus="F" home="Tift County" away="Warner Robins" homeScore="0" awayScore="5" notes="" division="AAAAA"/>
  4.  
  5. <sport id="25" game="Football" gameStatus="F" home="Coffee" away="Pierce County" homeScore="41" awayScore="0" notes=" Coffee looks to build on victory over Ware" division="AAAAA"/>
  6. <sport id="26" game="Football" gameStatus="F" home="Valdosta" away="Windsor Forest" homeScore="48" awayScore="7" notes="" division="AAAAA"/>
  7. <sport id="27" game="Football" gameStatus="F" home="Camden Co." away="Columbia, Fl" homeScore="30" awayScore="0" notes="" division="AAAAA"/>
  8. <sport id="28" game="Football" gameStatus="F" home="Bradwell Inst." away="Wayne Co." homeScore="28" awayScore="13" notes="" division="AAAAA"/>
  9. <sport id="29" game="Football" gameStatus="1" home="Richmond Hill" away="Johnson, Sav." homeScore="0" awayScore="0" notes="moved to 19th" division="AAAAA"/>
  10. <sport id="30" game="Football" gameStatus="F" home="Benedictine" away="Savannah" homeScore="30" awayScore="26" notes="" division="AAAAA"/>
  11. <sport id="31" game="Football" gameStatus="F" home="Ware Co." away="Burke Co." homeScore="34" awayScore="27" notes="Demtrius Wright returns a punt for 75 yard touchdown." division="AAAA"/>
  12. <sport id="32" game="Football" gameStatus="F" home="Cook " away="Brunswick" homeScore="14" awayScore="30" notes="" division="AA"/><sport id="33" game="Football" gameStatus="F" home="Charlton Co." away="First Coast" homeScore="32" awayScore="18" notes="" division="AA"/>
  13. <sport id="34" game="Football" gameStatus="F" home="Statesboro" away="Groves" homeScore="30" awayScore="6" notes="" division="AAAAA"/><sport id="35" game="Football" gameStatus="F" home="Swainsboro" away="Vidalia" homeScore="25" awayScore="26" notes="" division="AAA"/></sports>
  14.  
I need a way to update and edit this for the end user.

I'm open to suggestion as I have written a bit of asp but have very little experience with php/
Sep 11 '08 #1
2 1705
Atli
5,058 Expert 4TB
Hi.

I would look into SimpleXML.
Take a look at the examples there to see how to use it.

If that doesn't work for you (which it should), there are several other options available.
Sep 11 '08 #2
Dormilich
8,658 Expert Mod 8TB
if you're using php5 you may want to update/maintain you xml file with the DOMDocument class. It looks relatively easy since you only have to add one element (with several attributes).

another possibility is to process the file (as text) line by line, assuming that there is only one element per line.

regards

PS: the use of DOMDocument is comparable to the use of the DOM in JavaScript
Sep 11 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: David | last post by:
Would I be right in saying the following files are equilavent, except first on is HTML and second one is XML? Code: <? echo "<h1>Hello world!</h1>".<br>; echo "This is HTML"; ?>
7
by: Lab309 | last post by:
The problem I'm trying to solve is as follows: The website has two subdirectories: /ordinary and /phpstuff. Users typing hostname/ordinary get the file index.htm by default, and this works fine. ...
3
by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a...
3
by: Chris Paul | last post by:
I'm having trouble with PHP & PostgreSQL/OpenLDAP/Apache on Windows. I've set this up countless times on BSD (piece of cake) but I'm trying to do this on Windows now so that my developer can work...
1
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
9
by: Synapse Syndrome | last post by:
Hi I've been given what I am told is a PHP script to be used on my server. I do not know any PHP. I am trying to use a feature of a program called ArchiCAD. This feauture allows CAD drawing...
6
by: comp.lang.php | last post by:
I am trying to pipe in some auto-generated PHP into php.exe, to no avail: catch {exec echo '<? if (@is_file("./functions.inc.php")) { require_once("./functions.inc.php"); echo...
5
by: camphor | last post by:
hi, I have found an upload script in hotscripts and have implemented it into the website, I followed the installation steps to 'give write permissions to php on the upload folder (which is...
2
by: jackrose | last post by:
sir the below script is wap script in xml,if possible to converet html or php plz edit and put here sir <? //include the space function found on php.net Include ('data/function_dskspace.php'); ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.