Foro de elhacker.net

Programación => PHP => Mensaje iniciado por: qiqeroot en 17 Abril 2012, 17:41 pm



Título: Problema php -> xml
Publicado por: qiqeroot en 17 Abril 2012, 17:41 pm
Buenas tardes,
anteriormente generaba .xml con formularios con id fijas
pero tengo el problema de este formulario dinámico,
tengo que generar un xml a partir del siguiente código

Código:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Hoja de pedido</title>
<script>
var contLin = 1, tr, td, tabla;
function agregar() {

document.getElementById("OcultoContLin").value = contLin;
//var
tabla = document.getElementById('TablaMed');
tr = tabla.insertRow(tabla.rows.length);
td = tr.insertCell(tr.cells.length);
td.innerHTML = "<input type='text' size='7' name='' maxlength='7'>";
//alert (document.getElementById(td.innerHTML).id);
td = tr.insertCell(tr.cells.length);
td.innerHTML = "<input type='text' size='5' name='' maxlength='3'>";
td = tr.insertCell(tr.cells.length);
td.innerHTML = "<input type='text' size='40' name=''>";
contLin++;

}

function eliminarultima() {
    
    ultima = parseInt(document.getElementById('TablaMed').rows.length) - 1;

    if(ultima > 0){
        document.getElementById('TablaMed').deleteRow(ultima);
        contLin--;
        document.getElementById("OcultoContLin").value = contLin-1;
        }
}


</script>

<style type="text/css">
<!--
.Estilo1 {font-size: 12px}
.TEXTO { font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-style: normal;
line-height: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
color: #FFFFFF;
}
-->
</style>
</head>

<body>
<form id="form1" name="form1" method="get" action="Untitled-6.php">
  <table align="center" width="372" border="1" id="TablaMed">
    <tr class="Estilo1">
      <td width="150">Ref</td>
      <td width="150">Cantidad</td>
      <td width="150">Observaciones</td>
    </tr>
  </table>
  <table align="center" bgcolor="#FFFFCC">
      <td>
  <p>
    <input name="AgregaMed" type="button" id="AgregaMed" value="Agregar Linea de pedido" onclick="agregar()" />
    <input name="EliminarMed" type="button" id="EliminarMed" value="Eliminar linea de pedido" onclick="eliminarultima()" />
    Lineas de Pedido:<input name="OcultoContLin" type="text" size="4" id="OcultoContLin" style="visibility:visible" />
        <input name="cadena" type="submit" id="cadena" value="Procesar pedido"/>

  </p>
  </td>
   </table>
</form>
<p>&nbsp;</p>
</body>
</html>

la estructura del xml tiene que ser referencia, cantidad, observaciones pero realmente nose como enfocarlo, mis pruebas sin resultado.

gracias por vuestra ayuda de antemano