Hola que tal tengo una pregunta a ver si alguien me podria apoyar.
Estoy aprendiendo en este tipo de programacion de php javascript.. html
y tengo la siguiente situacion:
ten un formulario de captura de datos
digamos en la pagina captura_nota.php tengo los campos que deben de ser llenados despues de haber seleccionado una fila de la tabla donde guardo el resultado
codigo pagina captura_nota.php
Código HTML:
<?php
include('../config/vars.php');
include('../config/con_archivo.php');
date_default_timezone_set('America/Mazatlan');
$exp= "<script>document.getElementById('expediente').value ;</script>";;
$fecha_captura = date("Y-m-d");
$sql_tpofalla = "select * from consmed where show_cons = 1";
$result_q = mysql_query($sql_tpofalla,$conexion) or die(mysql_error());
$sql_exp = 'select * from exps where numexpmed ="'.$exp.'"';
$result_exp = mysql_query($sql_exp,$conexion) or die(mysql_error());
$rows_exps = mysql_fetch_array($result_exp);
?>
<!DOCTYPE html PUBLIC >
<html >
<head>
<link rel="stylesheet" media="screen" href="../css/inputs.css" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" media="screen" href="../css/login.css" type="text/css">
<link rel="stylesheet" media="screen" href="../css/evita-jui.css" type="text/css">
<link rel="stylesheet" href="../css/jquery-ui.css" />
<script type="text/javascript" src="../js/find-exp.js"></script>
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript" src="../js/jquery-ui.js"></script>
<script type="text/javascript" src="../js/jquery.validate.js">
</script>
<script>
$(function() {
$( "#fecha" ).datepicker(
{ dateFormat: "yy-mm-dd",
gotoCurrent: true,
minDate: -50,
maxDate: 0,
monthNames: [ "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Dieciembre" ],
dayNamesMin:["Dom","Lun","Mar","Mie","Jue","Vie","Sab"] ,
onSelect: function(dateText, inst) {document.getElementById('fecha').value=dateText; }
}
);
});
$(function(){
$('#new_nota').validate({
rules :
{
area : { required : true },
expediente : {required : true },
subexp:{required : true},
nomb:{required : true},
apat:{required : true},
nomb_doc:{required : true},
fecha:{required : true}
},
messages :
{
area : { required : "Seleccione el area de origen " },
expediente : {required : "ingrese el expediente" },
subexp:{required : "ingrese el subfolio"},
nomb:{required : "ingrese el nombre(s) del paciente"},
apat:{required : "ingrese el apeido paterno"},
nomb_doc:{required : "ingrese el nombre del medico que atendio"},
fecha:{required : "Seleccione una fecha"}
}
});
}
);
</script>
<title>Capturar Nota</title>
</head>
<body>
<div id="encab" >
<form id="new_nota" name="new_nota" action="" method="post" >
<table align="center" style="text-shadow:#CCC; color:#000; font-size:20px;" width="66%">
<tr>
<td colspan="5" valign="top"><div align="center" class="encabezado">Captura de Notas</div> </td>
</tr>
<tr>
<td valign="middle"> Area </td>
<td colspan="2" valign="middle">
<select id="area" name="area" style="font-size:22px;" >
<option value="" style="font-size:22px;">Selecciona una opcion</option>
<?php
while($rows_result = mysql_fetch_array($result_q))
{
echo ' <option value="'.$rows_result['CLVCAMED'].'">'.$rows_result['DESCAMED'].'</option>
';
}
?>
</select>
</td>
<td valign="middle">Fecha</td>
<td valign="middle"><input type="date" id="fecha" name="fecha" readonly style="font-size:22px; border: 1px solid #000;
background:#FFF;
font-family:'Lucida Sans Unicode', 'Lucida Grande', sans-serif" /></td>
</tr>
<tr>
<td valign="middle">Expediente</td>
<td width="181" valign="middle"><input type="text" size="15" style="font-size:22px; text-transform:uppercase;" maxlength="15" id="expediente" name="expediente" onClick="buscar_exp();" /></td>
<td width="79" valign="middle"></td>
<td width="145" valign="middle">Sub Expediente</td>
<td width="165" valign="middle"><input type="text" size="7" maxlength="4" style="font-size:22px; text-transform:uppercase; " id="subexp" name="subexp" /></td>
</tr>
<tr>
<td valign="middle">Nombre</td>
<td colspan="4">
<input type="text" size="40" style="font-size:22px; text-transform:capitalize;" maxlength="40" id="nomb" name="nomb" /></td>
</tr>
<tr>
<td valign="middle">A. Paterno</td>
<td colspan="5"><input type="text" size="30" style="font-size:22px; text-transform:capitalize" maxlength="30" id="apat" name="apat" /></td>
</tr>
<tr>
<td valign="middle">A. Materno</td>
<td colspan="5"><input type="text" size="30" style="font-size:22px; text-transform:capitalize" maxlength="30" id="amat" name="amat" /></td>
</tr>
<tr>
<td valign="middle">Medico</td>
<td colspan="5"><input type="text" size="50" style="font-size:22px; text-transform:capitalize" maxlength="50" id="nomb_doc" name="nomb_doc" /></td>
</tr>
<tr>
<td valign="top"></td>
<td>
<input type="reset" id="new" name="new" value="Cancelar" style="font-size:22px;" />
</td>
<td colspan="4" valign="middle">
<input type="submit" id="new" name="new" value="Guardar" style="font-size:22px;" />
</td>
</tr>
</table>
</form>
</div>
<br>
<div id="id_busca">
<table rules="rows" border="1" cellpadding="6" cellspacing="2">
<tr >
<td>Expediente</td>
<td><input type="text" id="exp-med" name="exp-med" onKeyUp="search_exp(); return false" /></td>
</tr>
</table>
<br>
<div id="resultado"></div>
</div>
</body>
<script type="text/javascript">
//ver si ya cargó el DOM
$(document).ready(function(){
$('body').attr('unselectable', 'on');
$('body').css('MozUserSelect', 'none');
$('body').css('KhtmlUserSelect', 'none');
});
$(function() {
$('#id_busca').dialog({
autoOpen: false,
height: 400,
width: 950,
resizable: false ,
modal: true,
buttons:{
"Aceptar":function() {$( this ).dialog( "close" );} ,
Cancel: function() {$( this ).dialog( "close" );}
}
});
$( "#expediente" )
.button()
.click(function() {
$( "#id_busca" ).dialog( "open" );
});
});
</script>
</html>
codigo pagina busca_datos.php
Código HTML:
<html>
<head>
</head>
<body>
<?php
require('../config/con_archivo.php');
require('../config/edad.php');
echo '
<table width="100%" rules="rows" border="1" cellpadding="6" cellspacing="2">
<tr >
<td>Expediente</td>
<td>Afiliacion</td>
<td>A. Paterno</td>
<td>A. Materno</td>
<td>Nombre</td>
<td>Edad</td>
<td>Genero</td>
</tr>
';
$num_exp = $_POST['num_exp'];
date_default_timezone_set('America/Mazatlan');
if ($num_exp <> "" )
{
$sql_lite='SELECT * FROM exps WHERE NUMEXPMED ="'.$num_exp .'"';
$fecha = date("Y-m-d") ;
$result_q = mysql_query($sql_lite,$conexion) or die(mysql_error());
$rw_cont = mysql_num_rows($result_q);
$cont = 0 ;
while($rows_result = mysql_fetch_array($result_q))
{
$cont ++ ;
$exp_med = $rows_result['NUMEXPMED'];
$sub_exp = $rows_result['SUBFOLIO'];
$nombre = $rows_result['NOMBRE'];
$apat = $rows_result['APATERNO'];
$amat = $rows_result['AMATERNO'] ;
echo'
<tr onClick="enviar_datos('.$exp_med.','.$sub_exp.','.$nombre.','.$apat.','.$amat.');" >
<td>'.$cont.'</td>
<td>'.$exp_med.'-'.$sub_exp.'</td>
<td>'.$rows_result['DESCAFILIACION'].'</td>
<td>'.$apat.'</td>
<td>'.$amat.'</td>
<td>'.$nombre.'</td>';
if ($rows_result['finado'] =='NO' ){
echo '
<td>'.edad($rows_result['fnacimiento']).'</td>';
}
else {
echo '
<td>Finado</td>';}
echo'
<td>'.$rows_result['DSEXO'].'</td>
</tr>';
}
}
mysql_free_result($result_q);
mysql_close($conexion);
?>
</body>
</html>
si alguien me podria orientar se lo agradecer bastante, gracias