Hola, estoy realizando una aplicacion web para captura de pedimentos, y estoy batallando con esto:
Hay una parte en donde se deben introducir fechas, puede ser de 1 a 6 fechas, lo que hice fue poner una tabla con checkbox y textfield, cuando el check box este activado, el textfield se activa, introdusco la fecha y listo. Pero cuando dejo disabled un campo de texto, e intertar guardar la info, me pone este error, y no guarda los datos:
Cita: Notice: Undefined index: f_entrada in C:\xampp\htdocs\knw\PEDIMENTOS\insert_pedimento.ph p on line 61
Notice: Undefined index: f_pago in C:\xampp\htdocs\knw\PEDIMENTOS\insert_pedimento.ph p on line 62
Notice: Undefined index: f_extraccion in C:\xampp\htdocs\knw\PEDIMENTOS\insert_pedimento.ph p on line 63
Notice: Undefined index: f_presentacion in C:\xampp\htdocs\knw\PEDIMENTOS\insert_pedimento.ph p on line 64
Notice: Undefined index: f_imp_euacan in C:\xampp\htdocs\knw\PEDIMENTOS\insert_pedimento.ph p on line 65
Notice: Undefined index: f_original in C:\xampp\htdocs\knw\PEDIMENTOS\insert_pedimento.ph p on line 66
Esto es suponiendo que todas esten disabled; asi, si dejo 5 enabled y 1 disabled, solo 1 error me aparece.
Este es el codigo de la tabla:
Código HTML:
<script type="text/javascript">
function enableText(checkBool, textID)
{
textFldObj = document.getElementById(textID);
//Disable the text field
textFldObj.disabled = !checkBool;
}
</script>
<table width="327" border="1">
<tr>
<th colspan="2" scope="col">FECHAS</th>
</tr>
<tr>
<td width="143"><input onclick="enableText(this.checked, 'entradatxt_fechas');" type="checkbox" name="entrada" id="entradachk_fechas" />
<label for="entrada"></label>
ENTRADA:</td>
<td width="168"><input name="f_entrada" type="text" disabled="disabled" id="entradatxt_fechas" maxlength="10" /></td>
</tr>
<tr>
<td><input type="checkbox" name="pago" id="pagochk" onclick="enableText(this.checked, 'pagotxt_fechas');" />
PAGO:</td>
<td><input name="f_pago" type="text" disabled="disabled" id="pagotxt_fechas" maxlength="10" /></td>
</tr>
<tr>
<td><input type="checkbox" name="extraccion" id="extraccionchk_fechas" onclick="enableText(this.checked, 'extracciontxt_fechas');" />
EXTRACCION:</td>
<td><input name="f_extraccion" type="text" disabled="disabled" id="extracciontxt_fechas" maxlength="10" /></td>
</tr>
<tr>
<td><input onclick="enableText(this.checked, 'presentaciontxt_date');" type="checkbox" name="presentacion" id="presentacionchk_fechas" />
PRESENTACION:</td>
<td><input name="f_presentacion" type="text" disabled="disabled" id="presentaciontxt_date" maxlength="10" /></td>
</tr>
<tr>
<td><input type="checkbox" name="impeuacan" id="impeuacan" onclick="enableText(this.checked, 'imp_euacan');" />
IMP. EUA/CAN:</td>
<td><input name="f_imp_euacan" type="text" disabled="disabled" id="imp_euacan" maxlength="10" /></td>
</tr>
<tr>
<td><input type="checkbox" name="original" id="original" onclick="enableText(this.checked, 'originaltxt');" />
ORIGINAL:</td>
<td><input name="f_original" type="text" disabled="disabled" id="originaltxt" maxlength="10" /></td>
</tr>
</table>
y este, un fragmento del que guarda a la BD (omiti todo ese rollo de conectar la BD, veo que es inecesario):
Código PHP:
$f_entrada = $_POST['f_entrada'];
$f_pago = $_POST['f_pago'];
$f_extraccion = $_POST['f_extraccion'];
$f_presentacion = $_POST['f_presentacion'];
$f_imp_euacan = $_POST['f_imp_euacan'];
$f_original = $_POST['f_original'];
$insertar2 = mysql_query("INSERT INTO fechas_pedimento (NUM_PEDIMENTO, FECHAS_ENTRADAS, FECHAS_PAGO, FECHAS_EXTRACCION, FECHAS_PRESENTACION, FECHAS_IMP_EUACAN, FECHAS_ORIGINAL)
VALUES ('{$num_pedimento}', '{$f_entrada}', '{$f_pago}', '{$f_extraccion}', '{$f_presentacion}', '{$f_imp_euacan}', '{$f_original}')", $conexion);
if (!$insertar2) {
die("Fallo en la insercion de registro en la Base de Datos: " . mysql_error());
}
La verdad no tengo idea de como hacerle para que me guarde unicamente los que esten enabled, y ya no me aparesca este error.
Espero puedan ayudarme, gracias de antemano.