tengo un sistema en donde tiene que seleccionar a través de un checkbox un trimestre
Trimestre 1
Trimestre 2
Trimestre 3
Trimestre 4
en la otra pagina esta el código de registro
Código PHP:
<?php
//Start session
session_start();
//Include database connection details
require_once('../../../config/config.php');
//Array to store validation errors
$errmsg_arr = array();
//Validation error flag
$errflag = false;
//Connect to mysql server
$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if(!$link) {
die('Failed to connect to server: ' . mysql_error());
}
//Select database
$db = mysql_select_db(DB_DATABASE);
if(!$db) {
die("Unable to select database");
}
//Function to sanitize values received from the form. Prevents SQL injection
function clean($str) {
$str = @trim($str);
if(get_magic_quotes_gpc()) {
$str = stripslashes($str);
}
return mysql_real_escape_string($str);
}
//Sanitize the POST values
$T1 = clean($_POST['T1']);
$T2 = clean($_POST['T2']);
$T3 = clean($_POST['T3']);
$T4 = clean($_POST['T4']);
//Input Validations
if($total == '') {
$errmsg_arr[] = 'FALTA CALCULOS';
$errflag = true;
}
if($codigo1 == '') {
$errmsg_arr[] = 'FALTA CODIGO DE ACTIVIDAD';
$errflag = true;
}
if($acti1 == '') {
$errmsg_arr[] = 'FALTA ACTIVIDAD ECONOMICA';
$errflag = true;
}
if($Declara1 == '') {
$errmsg_arr[] = 'FALTA DECLARACIÓN';
$errflag = true;
}
//Check for duplicate login ID
if($Declara1 != '') {
$qry = "SELECT * FROM iyc WHERE Declara1='$Declara1'";
$result = mysql_query($qry);
if($result) {
if(mysql_num_rows($result) > 0) {
$errmsg_arr[] = '<b>DECLARACIÓN YA REGISTRADA</b>';
$errflag = true;
}
@mysql_free_result($result);
}
else {
die("No hay conexion a la BD");
}
}
//If there are input validations, redirect back to the registration form
if($errflag) {
$_SESSION['ERRMSG_ARR'] = $errmsg_arr;
session_write_close();
header("location: declara.php");
exit();
}
//Create INSERT query
$qry = "INSERT INTO iyc (T1, T2, T3, T4 ) VALUES ('$T1','$T2','$T3','$T4')";
$result = @mysql_query($qry);
$last_id = mysql_insert_id();
?>
Notice: Undefined index: T3 in C:\xampp\htdocs\sedemat\industriacomercio\declara\ 01\registro.php on line 62
Notice: Undefined index: T4 in C:\xampp\htdocs\sedemat\industriacomercio\declara\ 01\registro.php on line 63
la linea 62: $T3 = clean($_POST['T3']);
la linea 63: $T4 = clean($_POST['T4']);
En la versión del Appeserver no me ocurría este error