Saludos
Revisar donde haces el insert into saque la seccion del if del sprintf, coloque un comentario para que te guies
Código PHP:
Ver original<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") {
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ?
intval($theValue) : "NULL"; break;
case "double":
$theValue = ($theValue != "") ?
"'" . doubleval($theValue) . "'" : "NULL"; break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); }
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { /*********************************************************** /
//Inclui las siguientes lineas no puedes hacer un if dentro de un sprintf
/************************************************************/
$monto=0;
$fecha="";
if ($_POST['chkIva']) {
$monto = GetSQLValueString($_POST['monto'] * 0.19, "int");
$fecha = GetSQLValueString($_POST['hora'] . ":" . $_POST['minuto'], "date");
}
$insertSQL = sprintf("INSERT INTO actividades (ot_id, actividad, monto, iva, horas_soporte) VALUES (%s, %s, %s, %s, %s)", GetSQLValueString($_POST['hiddenField'], "int"),
GetSQLValueString($_POST['actividad'], "text"),
GetSQLValueString($_POST['monto'], "int"),
$monto,
$fecha);
$insertGoTo = "cerrarPopUp.php";
if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= ( strpos($insertGoTo, '?')) ?
"&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING'];
}
}
?>