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 PostIf 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 …
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.