![Adios](http://static.forosdelweb.com/fdwtheme/images/smilies/adios.gif)
Espero que alguien pueda ayudarme, estoy haciendo un php para poder leer y luego modificar un xml.
Lo que me hace falta saber es como cambiar el nombre del input automaticamente de acuerdo a la cantidad de lineas que tenga el xml.
Nose si se entiende cual es mi pregunta asi que paso a poner lo que tengo.
notas.xml
Código PHP:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<content>
<featured>
<title>1231</title>
<copy>Texto 1.</copy>
<image>fotos/1231.JPG</image>
<link></link>
</featured>
<featured>
<title>1302</title>
<copy>Texto 2.</copy>
<image>fotos/1302.JPG</image>
<link></link>
</featured>
<featured>
<title>1024</title>
<copy>Texto 3.</copy>
<image>fotos/1024.JPG</image>
<link></link>
</featured>
<featured>
<title>802</title>
<copy>Texto 4.</copy>
<image>fotos/802.JPG</image>
<link></link>
</featured>
<featured>
<title>1423</title>
<copy>Texto 5.</copy>
<image>fotos/1423.JPG</image>
<link></link>
</featured>
<featured>
<title>1214</title>
<copy>Texto 6.</copy>
<image>fotos/1214.JPG</image>
<link></link>
</featured>
</content>
Código PHP:
<?php
$xmlstr = file_get_contents( 'notas.xml' );
$content = new SimpleXMLElement( $xmlstr );
$c2 = $content->$featured->title[0];
echo '<table>';
echo '<tr>';
echo '<th>Codigo</th><th>Texto</th>
<th>Direccion</th><th>-</th>';
echo '</tr>';
foreach( $content->featured as $featured ) {
echo '<tr>';
echo '<td><input type="text" name="nombre1" VALUE="' . $featured->title . '" size="10"></td>';
echo '<td>' . $featured->copy . '</td>';
echo '<td>' . $featured->image . '</td>';
echo '<td>' . $featured->link . '</td>';
echo '</tr>';
}
echo '</table>';
?>
Si alguien me puede dar una mano.
![Neurótico](http://static.forosdelweb.com/fdwtheme/images/smilies/scared.png)
Muchas gracias!
![Adios](http://static.forosdelweb.com/fdwtheme/images/smilies/adios.gif)