![sonriente](http://static.forosdelweb.com/fdwtheme/images/smilies/smile.png)
Mi consulta es porque necesito crear mediantes unas input el contenido de un xml, para que actulizar una web, en una input colocar la
ruta de la foto en otro la
descripcion en otro el
ancho y en otro el
largo y que se puedan colocar infinitos y una vez que finalizamos le apretamos Crear y nos hace el xml tal cual como lo adjunto, me dijeron que lo tengo que hacer con foreach y fwrite; tengo uno para crear un xml pero nose como hacer para que me genere todas las input que le ponga y nose como modificarlo para que me cree este xml. si alguien me puede ayudar.
PHP que crea un archivo xml
Código PHP:
<?
$trans_tbl = get_html_translation_table(HTML_ENTITIES);
foreach($trans_tbl as $k => $v)
{
$ttr[$v] = utf8_encode($k);
}
$text = strtr($text, $ttr);
if(isset($_POST['dato'])){
$datos = '<?xml version="1.0" encoding="UTF-8"?>
<gallery title="Example Title" frameColor="0xFFFFFF" frameWidth="10" imagePadding="20" displayTime="6">
<image>
<filename>'. $_POST["Nom"] .'</filename>
<caption>'. $_POST["Des"] .'caption>
<width>'. $_POST["W"] .'</width>
<height>'. $_POST["H"] .'</height>
</image>
</gallery>';
$archy= $_POST["dato"];
$file = fopen($archy,"w-");
fwrite($file,utf8_encode($datos));fclose($file);
header("Location: oksend.htm");
}
else
{
echo "output=no se han recibido los datos";
}
?>
XML a crear
Código PHP:
<?xml version="1.0" encoding="UTF-8"?>
<gallery title="Example Title" frameColor="0xFFFFFF" frameWidth="10" imagePadding="20" displayTime="6">
<image>
<filename>example.jpg</filename>
<caption>foto 10001.</caption>
<width>640</width>
<height>480</height>
</image>
<image>
<filename>example.jpg</filename>
<caption>foto 10002.</caption>
<width>640</width>
<height>480</height>
</image>
<image>
<filename>example.jpg</filename>
<caption>foto 10003.</caption>
<width>640</width>
<height>480</height>
</image>
<image>
<filename>example.jpg</filename>
<caption>foto 10004.</caption>
<width>640</width>
<height>480</height>
</image>
</gallery>