Ver Mensaje Individual
  #7 (permalink)  
Antiguo 24/02/2009, 02:29
Koden
 
Fecha de Ingreso: marzo-2005
Mensajes: 197
Antigüedad: 19 años, 2 meses
Puntos: 1
Respuesta: Problema con inputs y arrays

Simplifico la tabla que me falla, a ver si alguien lo ve más claro y me puede echar una mano.

Código PHP:
<?php
    $dias 
= array ();

    for (
$i 0$i <= 31$i++)
        
$dias[$i] = $i;

    
$nombres = array ("Dia\Mes","enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre");
?>
<table cellspacing="0" summary="table" class="broom_table">
    <thead><tr><?php for ($r_1 0$r_1 count ($nombres); $r_1++){?><th><?php echo $nombres[$r_1];?></th><?php }?></tr></thead>
    <tbody>
        <?php for ($r_1 1$r_1 count ($dias); $r_1 ++){?>
        <tr>
        <?php for ($r_2 0$r_2 count ($nombres); $r_2++){?>
        <?php
            $sel_2 
"SELECT " . ($r_1 1) . "_" . ($r_2 1) . " AS campo FROM estadillo WHERE id_producto='" $_GET["id_producto"] . "'";
            
$que_2 mysql_query ($sel_2$dbh) or die ('I cannot execute the query because: ' mysql_error () . '<br />And the query is: ' $sel_2 '<br />');
            
$x mysql_fetch_row ($que_2);
        
?>
            <td><input type="text" name="cols[<?php echo ($r_1 1);?>][<?php echo ($r_2 1);?>]" value="<?php echo $x["campo"];?>" size="3" /></td>
        <?php }?>
        </tr>
        <?php }?>
        <tr><td colspan="13"><input type="submit" value="Guardar" /></td></tr>
    </tbody>
</table>
Gracias a todos por vuestro tiempo y un saludo.