El problema es que me inserta 2 veces el mismo registro.
he aqui el código...a ver si me ayudan un pociquitin
Código PHP:
if(isset($_POST['hf_codigo_orden']) && strlen($_POST['hf_accion'])==0)
{
$R_CASCAB_ORDSERV_COD = $_POST['hf_codigo_orden'];
$R_CASCAB_JAULA = $_POST['txt_jaula'];
$R_CASCAB_CENTRO = $_POST['txt_centro'];
$R_CASCAB_ESPECIE = $_POST['txt_especie'];
$R_CASCAB_FMUESTREO = fecha($_POST['txt_FM']);
$R_CASCAB_FHRECEPCION = fecha($_POST['txt_FR']);
$R_CASCAB_COND_COD = $_POST['sel_condicion'];
$R_CASCAB_MSTRO_COD = $_POST['sel_muestreo'];
$R_CASCAB_MUES_COD = $_POST['sel_muestra'];
$R_CASCAB_ANAMNESIS = $_POST['txt_anamnesis'];
$R_CASCAB_CANTMUESTRAS = $_POST['txt_cantmuestras'];
$R_CASCAB_ZONA_COD = $_POST['sel_zona'];
$R_CASCAB_OBS = $_POST['txt_obs'];
$R_CASCAB_TERMINADO = 0;
$R_CASCAB_FACTURADO = 0;
$max = mysql_query("select max(cascab_cod)+1 as 'maximo' from casos_cabecera",$lnk);
if(mysql_num_rows($max)!=0)
{
$tmp=mysql_fetch_array($max);
if(strlen($tmp['maximo'])!=0)
{
$R_CASCAB_COD = $tmp['maximo'];
}
else
{
$R_CASCAB_COD = 1;
}
mysql_free_result($max);
}
else
{
$R_CASCAB_COD = 1;
}
$q ="";
$q= "insert into casos_cabecera values($R_CASCAB_COD,$R_CASCAB_ORDSERV_COD,'$R_CASCAB_FMUESTREO','$R_CASCAB_FHRECEPCION',$R_CASCAB_COND_COD,$R_CASCAB_MSTRO_COD,$R_CASCAB_MUES_COD,'$R_CASCAB_ANAMNESIS',$R_CASCAB_CANTMUESTRAS,'$R_CASCAB_OBS',$R_CASCAB_TERMINADO,$R_CASCAB_FACTURADO,'$R_CASCAB_CENTRO','$R_CASCAB_JAULA','$R_CASCAB_ESPECIE',$R_CASCAB_ZONA_COD)";
mysql_query($q,$lnk) or die(mysql_error());
header("Location: ingreso_casos.php?CLI_COD=".$_GET['CLI_COD']."&OS_NOM=".$_GET['OS_NOM']);