Cita:
Iniciado por Adler Hola
Dos cosas
+ En FF funciona perfectamente
+ Es imposible ayudarte si no se tiene acceso al código
Suerte
ok aca dejo el codigo completo a pedido de Adler !!!
Código PHP:
<?php
$conexion=mysql_connect("localhost","root","000000") or die("Problemas en la conexion");
mysql_select_db("empresa",$conexion) or die("Problemas en la selección de la base de datos");
if(isset($_POST['ok'])){
$nombre=array($_POST['name']);
$unidad=array($_POST['unid']);
$cant_mp=array($_POST['cant_mp']);
$desperdicio=array($_POST['desperdicio']);
$cos_mp_pesos=array($_POST['cos_mp_pesos']);
$cos_mp_dolar=array($_POST['cos_mp_dolar']);
$sub_mp_pesos=array($_POST['sub_mp_pesos']);
$sub_mp_dolar=array($_POST['sub_mp_dolar']);
foreach ($nombre as $nombre1){
foreach ($unidad as $unidad1){
foreach ($cant_mp as $cant_mp1){
foreach ($desperdicio as $desperdicio1){
foreach ($cos_mp_pesos as $cos_mp_pesos1){
foreach ($cos_mp_dolar as $cos_mp_dolar1){
foreach ($sub_mp_pesos as $sub_mp_pesos1){
foreach ($sub_mp_dolar as $sub_mp_dolar1){
echo "<PRE>";print_r ($nombre1); echo "</PRE>";}
echo "<PRE>";print_r ($unidad1); echo "</PRE>";}
echo "<PRE>";print_r ($cant_mp1); echo "</PRE>";}
echo "<PRE>";print_r ($desperdicio1); echo "</PRE>";}
echo "<PRE>";print_r ($cos_mp_pesos1); echo "</PRE>";}
echo "<PRE>";print_r ($cos_mp_dolar1); echo "</PRE>";}
echo "<PRE>";print_r ($sub_mp_pesos1); echo "</PRE>";}
echo "<PRE>";print_r ($sub_mp_dolar1); echo "</PRE>";}
}
?>
<!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" />-->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>PRUEBA FORO</title>
<script language='JavaScript'>
function add(tabla)
{
var tblBody = document.getElementById('tabla').tBodies[0];
var newNode = tblBody.rows[0].cloneNode(true);
tblBody.appendChild(newNode);
}
function borrar(obj) {
fila = obj.parentNode.parentNode;
fila.parentNode.removeChild(fila);
}
function get_name_from_list(){
if(document.getElementById('names_list')){
if(document.getElementById('code')){
if(document.getElementById('name')){
if(document.getElementById('unid')){
if(document.getElementById('cos_mp_pesos')){
if(document.getElementById('cos_mp_dolar')){
var code = document.getElementById('names_list').options[document.getElementById('names_list').selectedIndex].value;
var name = document.getElementById('names_list').options[document.getElementById('names_list').selectedIndex].text;
var unid = document.getElementById('names_list').options[document.getElementById('names_list').selectedIndex].getAttribute("alt");
var cos_mp_pesos = document.getElementById('names_list').options[document.getElementById('names_list').selectedIndex].getAttribute("alt1");
var cos_mp_dolar = document.getElementById('names_list').options[document.getElementById('names_list').selectedIndex].getAttribute("alt2");
document.getElementById('code').value=code;
document.getElementById('name').value=name;
document.getElementById('unid').value=unid;
document.getElementById('cos_mp_pesos').value=cos_mp_pesos;
document.getElementById('cos_mp_dolar').value=cos_mp_dolar;
}else{alert('Element costo_dolar not found!!!');}
}else{alert('Element costo_pesos not found!!!');}
}else{alert('Element unid not found!!!');}
}else{alert('Element name not found!!!');}
}else{alert('Element code not found!!!');}
}else{alert('Element names_list not found!!!');}
}
</script>
</head>
<body>
<?php
$resupieza=mysql_query("select * from piezas order by codigo",$conexion);
while($fila = mysql_fetch_array($resupieza)) //mientras haya registros en el resultado
{
$ultimo= $fila['codigo']+1;
}
?>
<form id="form" name="form" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<table border ="1" id="tabla" bordercolor="#FFCC33">
<font color="1166FF"><h4>MATERIA PRIMA</h4></font>
<tr>
<td>
<select onChange="get_name_from_list()" name="names_list" id="names_list" >
<option value="opcion">Seleccionar</option>
<?php
$resump=mysql_query("select * from materia_prima order by codigo",$conexion);
$sub_mp_pesos=10;
$sub_mp_dolar=20;
while ($row1=mysql_fetch_array($resump))
{
print "<option value='".$row1["codigo"]."' alt='".$row1["unidad"] ."',
alt1='".$row1["costo_mp_pesos"] ."',
alt2='".$row1["costo_mp_dolar"] ."'>
".$row1["nombre"]."</option>";
}
// if($codigo=$row1['codigo'])
// {
// $sub_mp_pesos=$sub_mp_pesos+$row1['costo_mp_pesos'];
// $sub_mp_dolar=$sub_mp_dolar+$row1['costo_mp_dolar'];
// }
echo "</n>"; // un select debajo del otro !!!
?>
</select>
</td>
<td><input type="hidden" size="5" name="code[]" id="code" disabled/></td>
<td><input type="text" size="25" name="name[]" id="name" /></td>
<td><input type="text" size="7" name="unid[]" id="unid" /></td>
<td><input type="text" size="7" name="cant_mp[]" id="cant_mp" value="Cantidad" /></td>
<td><input type="text" size="7" name="desperdicio[]" id="desperdicio" value="Desperdicio"/></td>
<td><input type="text" size="7" name="cos_mp_pesos[]" id="cos_mp_pesos" /></td>
<td><input type="text" size="7" name="cos_mp_dolar[]" id="cos_mp_dolar" /></td>
<td><input type="text" size="7" name="sub_mp_pesos[]" id="sub_mp_pesos" value="<?php echo $sub_mp_pesos;?>" /></td>
<td><input type="text" size="7" name="sub_mp_dolar[]" id="sub_mp_dolar" value="<?php echo $sub_mp_dolar;?>"/></n><br></td>
<td><input type="button" name="compb" value="[+]" onClick="add()"></td>
<td><input type="button" name="compb" value="[-]" onClick="borrar(this)"></td>
<hr>
</table>
<hr>
<td><input type="submit" name="ok" id="ok" value="OK" /></td>
<td><input type="submit" value="VOLVER"></td>
<td><input type="submit" value="LISTAR"></td>
<td><input type="submit" value="LISTAR SUB_MP"></td>
<hr>
</form>
</body>
</html>