hi
how to validate inputs in php.please send some same code for email and numbers...
thanks,
lydia
lydia21
9
Junior Poster
Recommended Answers
Jump to Postvalidating 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; } }
Jump to Postfor numbers,you can use this function:
function checknumber($fieldname) { if (is_numeric($fieldname)==TRUE)//if it is a number.. { return TRUE; } else { return FALSE; } }
All 7 Replies
somedude3488
228
Nearly a Posting Virtuoso
ryan_vietnow
13
Posting Pro
lydia21
9
Junior Poster
ryan_vietnow
13
Posting Pro
hacker9801
49
Junior Poster
lydia21
9
Junior Poster
lydia21
9
Junior Poster
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.