Ver Mensaje Individual
  #1 (permalink)  
Antiguo 24/02/2005, 15:52
tattojk
 
Fecha de Ingreso: febrero-2005
Mensajes: 673
Antigüedad: 19 años, 2 meses
Puntos: 2
Reacarga de pagina

Cordial Saludo.

En el form tengo 18 campos de los cuales debo buscar de acuerdo a dos campos: La Factura, cuando le de la factura debe traer algunos datos y El Diagnostico, cuando le de el codigo del diagnostico me debe traer el nombre del diagnostico, eso me lo hace bien, mi problema es que si le doy la factura todo bien me trae los datos a los text Pero si le digito el codigo del diagnostico tambien lo trae pero me borra el No. de factura y todos los datos que habia consultado

Este es el código:
<html>
<head>
<title>Consulta Afiliados</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<SCRIPT LANGUAGE='JavaScript'>
<!--
// Función que actualiza la página al cambiar el Número de Factura
function BuscaAfiliado ()
{
Factura = document.forms.form1.Factura.value;
window.location = 'ConsultaAfiliados.php?Factura=' + Factura;
}
// -->
<!--
// Función que actualiza la página al cambiar el Código de Diagnostico
function BuscaDiagnostico ()
{
Diagnostico = document.forms.form1.Diagnostico.value;
window.location = 'ConsultaAfiliados.php?Diagnostico=' + Diagnostico;
}
// -->

</SCRIPT>
</head>

<body onLoad="this.document.form1.Factura.focus();">
<?php
include "conexion.php";
if($_REQUEST['Factura']!="")
{
if(mssql_select_db ("ArsMigra", $conexion))
{
if($consul=mssql_query("Select AfiPriApellido,AfiSegApellido,AfiPriNombre,AfiSegN ombre,
AfiTipoIdenti,AfiNumIdenti from Afiliados where AfiNumCarne=$Factura"))
{
$reg = mssql_fetch_object($consul);
$VL_TipIden = $reg->AfiTipoIdenti;
$arr[0]=$VL_TipIden;
$VL_NumIden = $reg->AfiNumIdenti;
$VL_PriApel = $reg->AfiPriApellido;
$VL_SegApel = $reg->AfiSegApellido;
$VL_PriNomb = $reg->AfiPriNombre;
$VL_SegNomb = $reg->AfiSegNombre;
}
}
}
if($_REQUEST['Diagnostico']!="")
{
if(mssql_select_db ("ArsMigra", $conexion))
{
if($consul=mssql_query("Select [DESCRIPCION E] as Descripcion from CIE10 where CODIGO='$Diagnostico'"))
{
$reg = mssql_fetch_object($consul);
$VL_NombDiag = $reg->Descripcion;
}

}
}
mssql_close();

//Dibujo el Formulario

<form action="ConsultaAfiliados" method="post" name="form1">
<table width="75%" align="center">
<tr>
<td><div align="right">Factura</div></td>
<td><input name="Factura" type="text" id="Factura" size="10" maxlength="10" onChange="BuscaAfiliado()" value="';?><?php echo $Factura;?><?php echo'">
</td>
</tr>
<tr>
<td><div align="right">Tipo Identificaci&oacute;n</div></td>
<td><input name="txtTipIden" type="text" id="txtTipIden" size="2" maxlength="2" value="';?><?php echo $VL_TipIden;?><?php echo'" readonly></td>
<td>&nbsp;</td>
<td><div align="right">N&uacute;mero Identificaci&oacute;n</div></td>
<td><input name="txtNoIden" type="text" id="txtNoIden" size="16" maxlength="16" value="';?><?php echo $VL_NumIden;?><?php echo'" readonly></td>
</tr>
<tr>
<td><div align="right">Diagnostico</div></td>
<td><input name="Diagnostico" type="text" id="Diagnostico" size="6" onChange="BuscaDiagnostico()" value="';?><?php echo $Diagnostico;?><?php echo'"></td>
<td>&nbsp;</td>
<td><div align="right">Nombre Diagnostico</div></td>
<td><input name="txtNombDiag" type="text" id="txtNombDiag" size="50" maxlength="50" value="';?><?php echo $VL_NombDiag;?><?php echo'" readonly></td>
</tr>
</table>';
echo'</form>
';
?>
</body>
</html>

TRabajo con SqlServer.

Agradezco la ayuda y sugerencias que me puedan brindar.