Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/09/2008, 03:41
machoman112233
Invitado
 
Mensajes: n/a
Puntos:
Ayuda con ereg()

Buenas!!!!

Hace tiempo que no pasaba por aqui... XDXDXD

intento hacer un php para poder validar un formulario (nombre, apellido, fecha, email, etc...) por ahora llevo lo basico y me da un error... pero no encuentro nada de como solucionarlo...

Error
Código:
Warning: ereg() [function.ereg]: REG_BADBR
PHP
Código PHP:
<?php
function validar_formulario($tipo$variable)
{
    
$validar=False;
    switch(
$tipo)
    {
        case 
"nombre":
        {
            if(
ereg("^[a-zA-Z]{3-30}$",$variable))
            {
                
$validar=True;                
            }
        }break;
        
        case 
"apelido":
        {
            if(
ereg("^[a-zA-Z]{3-30}$",$variable))
            {
                
$validar=True;                
            }
        }break;
        
        case 
"email":
        {
            if (
ereg("^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@([_a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]{2,200}\.[a-zA-Z]{2,6}$"$variable ))
            {
                 
$validar=True;
            }
        }break;
        
        case 
"data":
        {
            if(
ereg("^[0-9]{1-2}/[0-9]{1-2}/[0-9]{4}$",$variable))
            {
                
$validar=True;
            }
        }break;
    }
    return (
$validar);
}