Pruebalo asi:
Código PHP:
Ver original<?php
//include 'conection.php';
/** conexion ***************************/
$link = mysql_connect('localhost', 'root', ''); // conectamos a la base de datos if(!$link) { // si no se conecta que mande error
}
$db_link = mysql_select_db('prueba', $link); // seleccionamos la base de datos if(!$db_link) { // si no selecciona la BD que mande error
}
/** fin conexion ************************/
if(isset($_REQUEST["ingresar"]) && $_REQUEST["ingresar"] == "Ingresar"){ if(isset($_REQUEST['norm'])){ $textos = $_REQUEST['norm'];
$year = $_REQUEST['year'];
}
for ($i=0;$i<count($textos);$i++){ if($year[$i] == 0){
}
$cedula = "000".$i;
if((isset($_REQUEST['norm'])) && (isset($_REQUEST['year']))) {
$insertSQL = mysql_query("INSERT INTO coco (identificacion, id_progsocial, ano) VALUES ('$cedula','".$textos[$i]."','".$year[$i]."')", $link) or
die(mysql_error()); }
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml2/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
</head>
<body>
<form action="" method="post" name="form1" id="form1">
<?php
$a = 0;
?>
<input name="norm[]" type="checkbox" value="<?php echo $Mostrar['Valor']; ?>"><?php echo $Mostrar['Nombre']; ?>
<input name="year[]" type="text" value="0" /><br />
<?php
++$a;
}
?>
<input id="input" type="submit" name="ingresar" value="Ingresar" />
</form>
</body>
</html>