PHP - PHP????????

 
Vista:

PHP????????

Publicado por maria jose (6 intervenciones) el 21/08/2006 21:41:18
hola a todos soy nueva aca me estoy volviendo loca con php. como hago para refrescar en un formulario por medio de un boton datos de la bd., es decir tengo una nómina y quiero que al introducir la cédula y pulse buscar me traiga de la bd algunos campos como nombre, apellido, etc..??? si alguien sabe please ayudaaaaaaaaaa... tengo este código

<?php
//variables a mostrar en el formulario
$nombre="";
$apellido="";
$sueldoquinc="";
$fechaing="";
$accion=$_Request['accion'];
$ci=$_Request['ci'];

if ($accion=="Buscar"){
//consulta en la bd
//realizar la conexion a la base de datos
$con=mysql_connect("localhost", "root", "");
$basedato=mysql_select_db("nómina");
$SqL="Select * from empleado where ci=$ci";
$query=mysql_query($sql);
$numero_de_registros=mysql_num_rows($query);
for ($i=0;$i<$numero_de_registros;$i++){
//traer los registros de la base de datos
$row=mysql_fetch_row($query);
$nombre=$row['nombre'];
$apellido=$row['apellido'];
$sueldoquinc=$row['sueldoquinc'];
$fechaing=$row['fechaing'];

}
}
?>





<input type="hidden" name="accion" value="buscar">
<form name="form1" method="post" >
<p align="center" class="Estilo2">Nómina de Empleados</p>
<p align="center"> </p>
<p align="justify">Código de la Nómina
<input type="text" name="codnom">

</p>
<table width="779" border="4">
<tr bgcolor="#9DB5E1">
<td colspan="6"><div align="center"><strong>Datos del Empleado </strong></div></td>
</tr>
<tr>
<td colspan="6"><div align="center">Cédula del Empleado
<!--Si realizo la busqueda deberia mostrar el nombre del empleado si no lo muestra en blanc-->
<input type="text" name="ci" value="<?=ci?>">
<input type="submit" name="buscar" value="Buscar">

</div></td>
</tr>
<tr>
<td colspan="6"> </td>
</tr>
<tr>
<td width="59">Nombre</td>
<td width="173"><input type="text" name="nombre" value="<?=nombre?>"></td>

<td width="61">Apellido</td>
<td width="163"><input type="text" name="apellido" value="<?=apellido?>"></td>
<td width="105">Fecha Ingreso</td>
<td width="172"><input type="text" name="fechaing" value="<?=fechaing?>"></td>
</tr>
</table>
<table width="779" border="4">
<tr bgcolor="#9DB5E1">

<td colspan="6"><div align="center"><strong>Asignaciones</strong></div></td>
</tr>
<tr>
<td width="114">Sueldo Quincenal</td>
<td width="144"><input type="text" name="sueldoquinc" value="<?=sueldoquinc?>"></td>
<td width="105">Sueldo Mensual</td>
<td width="144"><input type="text" name="sueldomens"></td>

<td width="82">Horas Extra</td>
<td width="144"><input type="text" name="horaext"></td>
</tr>
<tr>
<td colspan="6"> </td>
</tr>
<tr>
<td colspan="6"><div align="center">Total de Asignaciones
<input type="text" name="tasig">

<input type="submit" name="tasig" value="C">
</div></td>
</tr>
</table>
<table width="779" border="4">
<tr bgcolor="#9DB5E1">
<td colspan="6"><div align="center"><strong>Deducciones</strong></div></td>
</tr>

<tr>
<td width="99">Paro Forzoso</td>
<td width="148"><input type="text" name="parof"></td>
<td width="93">Ley P. H.</td>
<td width="170"><input type="text" name="leyph"></td>
<td width="79">Inasistencia</td>
<td width="144"><input type="text" name="inasist"></td>

</tr>
<tr>
<td colspan="6"> </td>
</tr>
<tr>
<td colspan="6"><div align="center">Total de Deducciones
<input type="text" name="tdeduc">
<input type="submit" name="tded" value="C">
</div></td>

</tr>
</table>
<p align="center"> </p>
<div align="center">
<table width="409" border="0">
<tr>
<td width="101"><strong>Total a Pagar </strong></td>
<td width="147"><input type="text" name="netopag"></td>

<td width="147"><input type="submit" name="total" value="Calcular"></td>
</tr>
</table>
</div>
<p align="center">
<input type="submit" name="guardar" value="Guardar">
</p>
<div align="center">
<table width="363" border="0">

<tr>
<td><div align="center"><a href="index.html">Menú Principal</a></div></td>
</tr>
</table>
</div>
<p align="center"> </p>
</form>
<p align="center">  </p>

</body>
</html>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:PHP????????

Publicado por The Emulator (24 intervenciones) el 22/08/2006 01:24:04
Hola

Prueba esto
Por ejemplo para el campo Nombre

<input type="text" name="apellido" value=<?php echo $Nombre;?>>

Saludos
http://www.theemulator.tk
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:PHP????????

Publicado por maria jose (8 intervenciones) el 29/08/2006 16:31:18
no lo hace???????????? ya no se que hacer para q me funcione
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar