Ver Mensaje Individual
  #9 (permalink)  
Antiguo 26/09/2008, 08:13
kireta
 
Fecha de Ingreso: agosto-2008
Mensajes: 54
Antigüedad: 16 años, 5 meses
Puntos: 0
Respuesta: como unier un $_post y strtoupper

DONDE PONGO EL strtoupper ??

Código php:
Ver original
  1. <?php
  2. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  3. {
  4.   $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
  5.  
  6.   switch ($theType) {
  7.     case "text":
  8.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  9.       break;    
  10.     case "long":
  11.     case "int":
  12.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  13.       break;
  14.     case "double":
  15.       $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
  16.       break;
  17.     case "date":
  18.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  19.       break;
  20.     case "defined":
  21.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  22.       break;
  23.   }
  24.   return $theValue;
  25. }
  26.  
  27. $editFormAction = $_SERVER['PHP_SELF'];
  28. if (isset($_SERVER['QUERY_STRING'])) {
  29.   $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
  30. }
  31.  
  32. if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  33.   $insertSQL = sprintf("INSERT INTO estudiante (apellido, nombre, cedula, codigo, rango, especializacion, ciudadcasa, dircasa, telcasa, celular1, celular2, email1, email2, empresa, ciudadjob, cargo, teljob, observacion, ingresoyear, usuario, password, nivel) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
  34.                        GetSQLValueString($_POST['apellido'], "text"),
  35.                        GetSQLValueString($_POST['nombre'], "text"),
  36.                        GetSQLValueString($_POST['cedula'], "text"),
  37.                        GetSQLValueString($_POST['codigo'], "text"),
  38.                        GetSQLValueString($_POST['rango'], "text"),
  39.                        GetSQLValueString($_POST['especializacion'], "text"),
  40.                        GetSQLValueString($_POST['ciudadcasa'], "text"),
  41.                        GetSQLValueString($_POST['dircasa'], "text"),
  42.                        GetSQLValueString($_POST['telcasa'], "text"),
  43.                        GetSQLValueString($_POST['celular1'], "text"),
  44.                        GetSQLValueString($_POST['celular2'], "text"),
  45.                        GetSQLValueString($_POST['email1'], "text"),
  46.                        GetSQLValueString($_POST['email2'], "text"),
  47.                        GetSQLValueString($_POST['empresa'], "text"),
  48.                        GetSQLValueString($_POST['ciudadjob'], "text"),
  49.                        GetSQLValueString($_POST['cargo'], "text"),
  50.                        GetSQLValueString($_POST['teljob'], "text"),
  51.                        GetSQLValueString($_POST['observacion'], "text"),
  52.                        GetSQLValueString($_POST['ingresoyear'], "date"),
  53.                        GetSQLValueString($_POST['usuario'], "text"),
  54.                        GetSQLValueString($_POST['password'], "text"),
  55.                        GetSQLValueString($_POST['nivel'], "text"));
  56.  
  57.   mysql_select_db($database_postgrados, $postgrados);
  58.   $Result1 = mysql_query($insertSQL, $postgrados) or die(mysql_error());
  59.  
  60.   $insertGoTo = "index.php";
  61.   if (isset($_SERVER['QUERY_STRING'])) {
  62.     $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
  63.     $insertGoTo .= $_SERVER['QUERY_STRING'];
  64.   }
  65.  header(sprintf("Location: %s", $insertGoTo));
  66. }
  67.  
  68.  
  69. mysql_select_db($database_postgrados, $postgrados);
  70. $query_Recordset1 = "SELECT * FROM estudiante";
  71. $Recordset1 = mysql_query($query_Recordset1, $postgrados) or die(mysql_error());
  72. $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  73. $totalRows_Recordset1 = mysql_num_rows($Recordset1);
  74. ?>

Última edición por jam1138; 26/09/2008 a las 08:58 Razón: Coloreo código