Multiple entries output as XML

simong 29 Oct, 2009
Hi Bob and Max,
I am at it again - though this time it gets complex. Is this possible -
a) I have a user that must complete a form that carries information about exercises they have performed (this is for a gym).
b) I would like each user to export their data under their username so once they have completed the form 5 times, all the data can be written to one XML file, specific to that user; the aim being to display a chronography of all their entries (the form will be consistent across all users).
c) This data is then fetched by 'amcharts' (fantastic graphing software) to display the users health scores over the course of exercises.

Is it possible? Where do I start?
GreyHead 29 Oct, 2009
Hi simong,

Yes, you can create xml files OK, I've done several recently. It needs hand coding using the PHP DOM Functions


PS Here's an extract from a code chunk to create an xml file (the data here is the $p object, and much of the detailed code is omitted):
/* Fabrication du fichier .xml */
$dom = new DomDocument('1.0', 'UTF-8');
$main_details  = $root->appendChild($dom->createElement('main_details'));
$elements = array(
  'reference' => $p->ref,
  'title' => $p->texte_xml_intitule_en,
  'link' => $link,
  'prix' => $p->prixdevente,
  'bedrooms' => $p->bedrooms,
  'land_size' => $p->carrez_space,
  'department' => $p->department_id,
  'property_type' => $this->getFeatureValue('types', $p->type_id),
  'floors' => $p->nb_etages,
  'sale_status' => ''
foreach ( $elements as $k => $v ) {
  $main_details->appendChild($dom->createElement($k, $v));
$description = $main_details->appendChild($dom->createElement('description'));
$dom->formatOutput = true;
simong 29 Oct, 2009
Hi Bob,
Thanks again for your great support.
Being a pencil pusher rather than a coder... am I correct in reading this code, that multiple submissions from a given user will produce a single "amended" (added to) XML file for that user alone ie: 10 users, 10 xml files (each having registered and logged-in)

Thanks Bob
GreyHead 29 Oct, 2009
Hi simong,

Depends on how you write the code and what the requirement is. You could have one per user, one for all users (with separate sections for each user). You can update an existing file or re-create a new one . . . too much choice!

simong 29 Oct, 2009
Thanks Bob (once again)
Let me build the form and I will get back to you. Thanks for a great app.
This topic is locked and no more replies can be posted.