There are 2 ways that i make xml files with php.

1. Use domxml to make the docs. (RTM this is somewhat complex.)
2. Just create it similar to html but use xml tags.

The second way is really easy.

1. Make sure to send header content type as text/xml. 
        header( "Content-Type: text/xml" );
2. Just wrap you data with tags.

Example:

<?php
header( "Content-Type: text/xml" );

$xmlpage = '<?xml version="1.0"?>';
$xmlpage .= '<page>';

foreach( $formdata => $index as $value ) {
  // $formdata is an associative array
  // meaning that $index is a name rather than
  // a array index number.
  $xmlpage .= '<'.$index.'>'.$value.'</'.$index.'>';
}

$xmlpage .= '</page>';

echo $xmlpage;

?>

This is a very simple example...but should get you up and running.

--
BigDog


On Mon, 2003-07-14 at 10:49, Jeffrey Fitzgerald wrote:
>     Looking for direction PHP and XML. I have a need to build a simple XML 
> doc from a PHP set of form vars. Any tips or examples are greatly appreciated.
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to