gazever Posted September 17, 2007 Share Posted September 17, 2007 Hi I know this will seem really simple, How do I validate a string for only characters a-z A-Z and 0-9, I have tried lots of different eregi, but cant get the syntax right, Thanks Gaz Quote Link to comment https://forums.phpfreaks.com/topic/69692-simple-question/ Share on other sites More sharing options...
marcus Posted September 17, 2007 Share Posted September 17, 2007 For just alphanumeric keys use ctype_alnum() Quote Link to comment https://forums.phpfreaks.com/topic/69692-simple-question/#findComment-350159 Share on other sites More sharing options...
gazever Posted September 17, 2007 Author Share Posted September 17, 2007 fantastic thanks Quote Link to comment https://forums.phpfreaks.com/topic/69692-simple-question/#findComment-350162 Share on other sites More sharing options...
cooldude832 Posted September 17, 2007 Share Posted September 17, 2007 A more generic solution is to use regex to verify that the string follows the proper pattern of characters and number. There is a regex forum here and lots of good tutorials out there to learn it. The function is preg() Quote Link to comment https://forums.phpfreaks.com/topic/69692-simple-question/#findComment-350164 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.