Código Javascript:
Ver original
<SCRIPT LANGUAGE="JavaScript"> function addNewRow(){ var TABLE = document.getElementById("base"); var TROW = document.getElementById("example"); var content = TROW.getElementsByTagName("td"); var newRow = TABLE.insertRow(-1); newRow.className = TROW.attributes['class'].value; insertLOselect(content,newRow); var newRow2 = TABLE.insertRow(-1); newRow2.className = TROW.attributes['class'].value; //window.alert(content); copyRow(content,newRow2); } function removeLastRow() { var TABLE = document.getElementById("base"); if(TABLE.rows.length > 2) { TABLE.deleteRow(TABLE.rows.length-1); TABLE.deleteRow(TABLE.rows.length-1); } } function appendCell(Trow, txt) { var newCell = Trow.insertCell(Trow.cells.length) newCell.innerHTML = txt } function copyRow(content,Trow) { var cnt = 0; for (; cnt < content.length; cnt++) { appendCell(Trow, content[cnt].innerHTML); } } function insertLOselect(content,Trow) { var cnt = 0; for (; cnt < content.length-1; cnt++) { appendCell(Trow, ' '); } /* str = '<td>'; str += ' <select id="LO" class="combo" name="logical[]">'; str += ' <option value="Y">and</option>'; str += ' <option value="or">or</option>'; str += ' </select>'; str += '</td>'; appendCell(Trow,str);*/ } </script>
Eee es el javascript que hace la funcion de agregarme la filas ahora le dejo el del formulario.
Código HTML:
Ver original
<form method="post" name="nuevoarticulo" action="Ingresar_Articulos.php"> <table border="0" id="base" width="100%"> <tr class="celda"> </tr> <tr id="example" class="celda"> <?php for ($l=0;$l<mysql_num_rows($programas);$l++) { $encar = mysql_result($programas,$l,"programas"); echo "<option value=\"$encar \">$encar </option>"; } ?> </tr> </table> <input name="Guardar" type="submit" value="Guardar" /> <input type="reset" name="Clear" id="Clear" value="Limpiar" /> </form>
el codigo guardar, me guardar pero solamente el primer select si agrego mas select no me guardar "SIEMPRE ME GUARDAR EL PRIMERO".
Código PHP:
?php
if (isset($_POST['idequipo']))
{
if ($_POST['idequipo']!=""){
$qid=$_POST['idequipo']; // no tomen encuenta esto es de otro insert into
$qencargado=$_POST['encargado'];
$qubicacion=$_POST['ubicacion'];
$qprogramas=$_POST['programas'];
$sql = mysql_query("INSERT INTO software_inst(idequipo,encargado,ubicacion,programas)
VALUES('$_POST[idequipo]','$_POST[encargado]','$_POST[ubicacion]','$qprogramas')");
echo "<script>alert('Registro Guardado Correctamente')</script>";
}else{
echo "No introdujo el id de equipo";
}
}
?>