hi
how to validate inputs in php.please send some same code for email and numbers...
thanks,
lydia

validating in php really isn't that hard. i have been using this function for a while. i don't know if it is the best way but it works for me.

function check($fieldname)
{
  if(!preg_match("/[^a-zA-Z0-9\.\-\Ä\ä\Ö\ö\Ü\ü\,\
   ]+$/s",$fieldname)) {
    return TRUE;
}
else {
    return FALSE;
}
}

for numbers,you can use this function:

function checknumber($fieldname)
{

if (is_numeric($fieldname)==TRUE)//if it is a number..
{
return TRUE;
}
else
{
return FALSE;
}

}

for numbers,you can use this function:

function checknumber($fieldname)
{

if (is_numeric($fieldname)==TRUE)//if it is a number..
{
return TRUE;
}
else
{
return FALSE;
}

}

hi
this is not working for me...

What do you mean it does not work?

If it doesn't work, you're not doing it right. Learn basic PHP skills before you post.

@ryan_vietnow: you might want to simplify that; the function returns what is_numeric does on it's own.
Just do something like

$x = $_GET['foo']; echo is_numeric($x);

@lydia21: you posted this same thread 3+ times...

ya the code the which u have send me is not working

ya the code which u have send me is not working

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.