2
Hello, good morning.
I am generating xml with php, but the code is getting everything in a single line, I need it to be ideated when generated, respecting the hierarchy. I have no idea how you do it
Follows the code used
<?php
if(isset($_POST['create_xml'])){ echo "Programação das salas realizada";
/* All Links data from the form is now being stored in variables in string format */
$miro = $_POST['miro'];
$monet = $_POST['monet'];
$picasso = $_POST['picasso'];
$xmlBeg = "<?xml version='1.0' encoding='utf-8'?>";
$rootELementStart = "<reunioes>";
$rootElementEnd = "</reunioes>";
$xml_document= $xmlBeg;
$xml_document .= $rootELementStart;
$xml_document .= "<monet>";
$xml_document .= $monet; $xml_document .= "</monet>";
$xml_document .= "<picasso>";
$xml_document .= $picasso; $xml_document .= "</picasso>";
$xml_document .= "<miro>";
$xml_document .= $miro; $xml_document .= "</miro>";
$xml_document .= $rootElementEnd;
$path_dir .= "reunioes" .".xml";
/* Data in Variables ready to be written to an XML file */
$fp = fopen($path_dir,'w');
$write = fwrite($fp,$xml_document);
/* Loading the created XML file to check contents */
$sites = simplexml_load_file("$path_dir");
echo "<br> Checking the loaded file <br>" .$path_dir. "<br>";
?>
I am beginner, so the difficulty, the tutorials of the net did not tell me about t n, thank you very much for the help.
– Leonardo
@Leonardo gives a read on [tour] and see that you can accept an answer that solved your problem. Soon you can vote on everything on the site.
– Maniero