jeffrydell Posted July 25, 2007 Share Posted July 25, 2007 This is my first attempt at validating inputs to a form, please be gentle. I want to be sure that no letters are input to a field which should be a phone number. Should this work? Is there a better way? eregi('a-z', $_REQUEST['phone']) Thanks! Jeff Link to comment https://forums.phpfreaks.com/topic/61695-eregi-question/ Share on other sites More sharing options...
Ninjakreborn Posted July 25, 2007 Share Posted July 25, 2007 www.regularexpressions.info I think it is, will show you everything you need to know about "basic" regular expressions (compatible via every major language). Link to comment https://forums.phpfreaks.com/topic/61695-eregi-question/#findComment-307112 Share on other sites More sharing options...
sasa Posted July 25, 2007 Share Posted July 25, 2007 no try <?php $_REQUEST['phone'] = '123-456p'; if (eregi('[a-z]+', $_REQUEST['phone'])) echo 'some leters'; else echo 'no leters'; ?> Link to comment https://forums.phpfreaks.com/topic/61695-eregi-question/#findComment-307122 Share on other sites More sharing options...
jeffrydell Posted July 25, 2007 Author Share Posted July 25, 2007 sasa, Thank you - that works exactly as I had hoped. Jeff Link to comment https://forums.phpfreaks.com/topic/61695-eregi-question/#findComment-307146 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.