Foros del Web » Programando para Internet » PHP »

validar una caja de texto, como?

Estas en el tema de validar una caja de texto, como? en el foro de PHP en Foros del Web. hola ahora se me presento algo super facil, pero me ah dado muchos doloresde cabeza.... quiero que cuando el usuario le haga click le salga ...
  #1 (permalink)  
Antiguo 03/02/2005, 13:55
 
Fecha de Ingreso: febrero-2005
Ubicación: chile, Santiasko
Mensajes: 728
Antigüedad: 19 años, 2 meses
Puntos: 1
validar una caja de texto, como?

hola ahora se me presento algo super facil, pero me ah dado muchos doloresde cabeza....

quiero que cuando el usuario le haga click le salga un mensaje disiendo que falta llenar por ejemplo el nombre y el rut.... hasta que tenge todo completo pueda seguir a la otra pantalla.

aqui mostrare el codigo, pero falta el del formulario, que es muy largo, asi que creo que aqui se debe validar eso... el formulario en el action apunto a este codigo.

ok salu2 y gracias de antemano, un novato en esto....

Código PHP:
<?php  require_once('Connections/lll.php'); ?>
<?php

function GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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 usuario (NOMBRES, APELLIDOP, APELLIDOM, RUT, DV, TELEFONO, TELEFONOT, CELULAR) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
                        
GetSQLValueString($_POST['NOMBRES'], "text"),
                       
GetSQLValueString($_POST['APELLIDOP'], "text"),
                       
GetSQLValueString($_POST['APELLIDOM'], "text"),
                       
GetSQLValueString($_POST['RUT'], "text"),
                       
GetSQLValueString($_POST['DV'], "text"),
                       
GetSQLValueString($_POST['TELEFONO'], "text"),
                       
GetSQLValueString($_POST['TELEFONOT'], "text"),
                       
GetSQLValueString($_POST['CELULAR'], "text"));   
    
 
mysql_select_db($database_lll$lll);
  
$Result1 mysql_query($insertSQL$lll) or die(mysql_error());
 
$insertGoTo "registro_profesor.php";
 
 if (isset(
$_SERVER['QUERY_STRING'])) 
  {
    
$insertGoTo .= (strpos($insertGoTo'?')) ? "&" "?";
    
$insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  
header(sprintf("Location: %s"$insertGoTo));
}

?>
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 08:45.