Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/06/2009, 11:38
flashtkd
 
Fecha de Ingreso: agosto-2008
Mensajes: 587
Antigüedad: 15 años, 8 meses
Puntos: 6
Con validar un textinput con funciones

Con validar un textinput con funciones

Hola tengo la funcion lista, pero no me la reconoce el textinput, como lo relaciono.

Código PHP:

function comprobar_email($email){
    
$mail_correcto 0;
    
//compruebo unas cosas primeras
    
if ((strlen($email) >= 6) && (substr_count($email,"@") == 1) && (substr($email,0,1) != "@") && (substr($email,strlen($email)-1,1) != "@")){
       if ((!
strstr($email,"'")) && (!strstr($email,""")) && (!strstr($email,"")) && (!strstr($email,"$")) && (!strstr($email," "))) {
          //miro si tiene caracter .
          if (substr_count($email,"
.")>= 1){
             //obtengo la terminacion del dominio
             $term_dom = substr(strrchr ($email, '.'),1);
             //compruebo que la terminación del dominio sea correcta
             if (strlen($term_dom)>1 && strlen($term_dom)<5 && (!strstr($term_dom,"
@")) ){
                //compruebo que lo de antes del dominio sea correcto
                $antes_dom = substr($email,0,strlen($email) - strlen($term_dom) - 1);
                $caracter_ult = substr($antes_dom,strlen($antes_dom)-1,1);
                if ($caracter_ult != "
@" && $caracter_ult != "."){
                   $mail_correcto = 1;
                }
             }
          }
       }
    }
    if ($mail_correcto)
       return 1;
    else
       return 0;
}


<form name="
form1" method="post" action="index.php">
  <input type="
text" name="txtvalidar">
</form>