phpretard Posted February 21, 2009 Share Posted February 21, 2009 I do not want any special characters but spaces and capital Letters are OK The code below is blocking spaces and capital letters I think if (!preg_match('/^[^a-z0-9-_]+$/i',$docName)){ $error="<script>alert('The Document Name May Only Contain Letter And Numbers')</script>"; } Any help? Link to comment https://forums.phpfreaks.com/topic/146251-solved-simple-validation/ Share on other sites More sharing options...
only one Posted February 21, 2009 Share Posted February 21, 2009 preg_match('/^[a-zA-Z0-9_- ]+$/i', $docName) Link to comment https://forums.phpfreaks.com/topic/146251-solved-simple-validation/#findComment-767784 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.