que tal amigos bueno tengo un problema al insertar datos
cargar combo de empleados carcboemp.php
Código PHP:
<?
include("../connections/con_tci.php");
mysql_select_db("db");//selecionamos la base de datos
$query="select EMP_CODIGO, emp_apellido,emp_nombre from tbl_empleado ORDER BY emp_apellido";
$resultado=mysql_query($query) or die( mysql_error() );
$num=mysql_num_rows($resultado);
echo "<select name=\"empleado\">
<option>Empleado</option>";
while($row=mysql_fetch_array($resultado))
{
$EMP_CODIGO=stripslashes ($row["EMP_CODIGO"]);
$nombre=stripslashes ($row["emp_nombre"]);
$apellido=stripslashes($row["emp_apellido"]);
echo"<option value=\"$EMP_CODIGO\"> $apellido $nombre</option>";
}
echo "</select>";
?>
formulario frmingresos.php
Código HTML:
<form action="../php/insertar_ingresos.php">
<table width="457" border="0" align="left">
<tr>
<th scope="col" colspan="4">INGRESOS</th>
</tr>
<tr>
<td width="118">EMPLEADO:</td>
<td width="248"><? include("../php/carcboemp.php");?></td>
</tr>
<tr>
<td>Fecha ingreso: </td>
<td><label>
<input type="text" name="txtdias">
</label></td>
</tr>
<tr>
<td>Dias Trabajados: </td>
<td><label>
<input type="text" name="txtfecha">
</label></td>
</tr>
<tr>
<td>Remuneracion:</td>
<td><label>
<input type="text" name="txtremuneracion">
</label></td>
</tr>
<tr>
<td>Otros Ingresos : </td>
<td><label>
<input type="text" name="txtotrosingresos">
</label></td>
</tr>
<tr>
<td>Refrigerio:</td>
<td><label>
<input type="text" name="txtrefrigerio">
</label></td>
</tr>
<tr>
<td>Movilización</td>
<td><label>
<input type="text" name="txtmovilzacion">
</label></td>
</tr>
<tr>
<td>Aporte Personal: </td>
<td><label>
<input type="text" name="txtaporperi">
</label></td>
</tr>
<tr>
<td>Total:</td>
<td><label>
<input type="text" name="txttotal" >
<input type="submit" name="Submit" value="Enviar">
</label></td>
</tr>
</table>
</form>
insetar_ingresos.php
Código PHP:
<?
include("../Connections/con_tci.php");
$cod_empleado=$_POST["EMP_CODIGO"];
$dias=$_POST["txtdias"];
$fecha=$_POST["txtfecha"];
$remuneracion=$_POST["txtremuneracion"];
$otrosing=$_POST["txtotrosingresos"];
$refrigerio=$_POST["txtrefrigerio"];
$movilizacion=$_POST["txtmovilizacion"];
$aporperi=$_POST["txtaporperi"];
$total=$remuneracion+$otrosing+$refrigerio+$movilizacion+$aporperi;
//selecionamos la base de datos
mysql_select_db("db");
//relizamos el query
$query="insert into tbl_ingresos values (null,'".$cod_empleado."','".$dias."','".$fecha."','".$remuneracion."','".$otrosing."','".$refrigerio."','".$movilizacion."','".$aporperi."','".$total."')";
//ejecutamos la instrucion sql
$resultado=mysql_query($query);
if($resultado)
{
echo"datos guardados";
}
else
{
echo"error.. al guardar los datos";
}
?>
bueno el problema es que ingresa los datos y todos con valor 0.00 inclusive el codigo del empleado sale en blanco
esta es la tabla de los ingresos espero y me puedan ayudar
CREATE TABLE `tbl_ingresos` (
`ING_CODIGO` int(11) NOT NULL auto_increment,
`EMP_CODIGO` varchar(20) NOT NULL,
`ing_dias` int(2) default NULL,
`ing_fecha` date default NULL,
`ing_remuneracion` decimal(4,2) default NULL,
`ing_otros_ing` decimal(4,2) default NULL,
`ing_refrigerio` decimal(4,2) default NULL,
`inh_movilizacion` decimal(4,2) default NULL,
`ing_aporte_personal` decimal(4,2) default NULL,
`ing_total` decimal(4,2) default NULL,
PRIMARY KEY (`ING_CODIGO`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=13 ;