Ver Mensaje Individual
  #3 (permalink)  
Antiguo 25/03/2013, 16:23
drummerick7
 
Fecha de Ingreso: marzo-2013
Mensajes: 72
Antigüedad: 11 años, 1 mes
Puntos: 0
Respuesta: Formulario con menu despleglable y BD

alex1084..... grax por responder pero... a que te refieres con codigo con que guardo en bd si, si guarda. solo seleccionando la segunda opcion, pero aqui te dejo mi codigo

<?php require_once('../Connections/conexion.php'); ?>

<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

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")) {
$insertSQL = sprintf("INSERT INTO puertos (fecha_actualizacion, nombre_de_puerto, num_inscritos, num_graduados, fecha_certificacion, quien_impartio_maestro1, quien_impartio_maestro2, quien_impartio_auxiliar1, quien_impartio_auxiliar2, nom_iglesia, comentarios) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['fecha_actualizacion'], "date"),
GetSQLValueString($_POST['nombre_de_puerto'], "text"),
GetSQLValueString($_POST['num_inscritos'], "int"),
GetSQLValueString($_POST['num_graduados'], "int"),
GetSQLValueString($_POST['fecha_certificacion'], "date"),
GetSQLValueString($_POST['quien_impartio_maestro1'], "text"),
GetSQLValueString($_POST['quien_impartio_maestro2'], "text"),
GetSQLValueString($_POST['quien_impartio_auxiliar1'], "text"),
GetSQLValueString($_POST['quien_impartio_auxiliar2'], "text"),
GetSQLValueString($_POST['nom'], "text"),
GetSQLValueString($_POST['comentarios'], "text"));

mysql_select_db($database_conexionelrio, $conexionelrio);
$Result1 = mysql_query($insertSQL, $conexionelrio) or die(mysql_error());

$insertGoTo = "eEntrenar_2puertos_ver.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}