Jump to content

Recommended Posts

[!--quoteo(post=385948:date=Jun 20 2006, 01:47 PM:name=Orio)--][div class=\'quotetop\']QUOTE(Orio @ Jun 20 2006, 01:47 PM) [snapback]385948[/snapback][/div][div class=\'quotemain\'][!--quotec--]
if (!eregi("^[a-z]+$",$name)
{die("Invalid name");};
[/quote]
according to your syntax that you gave i tried to write this
function check_Name($Name,$FamName)
{
if ((!eregi("^[a-z]+$",$Name))||(!eregi("^[a-z]+$",$FamName)))
{
$ans=FALSE;
}
else
{
$ans=TRUE;
}
return $ans;

}


but it is still taking numbers can you tell me if the code up is wrong please thank you
Strange it works for me!:[code]<?php

function check_Name($Name, $FamName)
{
    if ((!eregi("^[a-z]+$",$Name)) || (!eregi("^[a-z]+$",$FamName)))
    {
        $ans = FALSE;
    }
    else
    {
        $ans = TRUE;
    }
    return $ans;
}

if(check_Name('j0hn', 'w3lls'))
{
    echo "valid!";
}
else
{
    echo "invalid!";
}

?>[/code]
With numbers it echos invalid, without - john wells - its valid.

How are you checking whether the function returns true or false?
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.