runnerjp Posted September 6, 2008 Share Posted September 6, 2008 currently i have allow only numbers to be entered into db hey guys... what im looking to do is let users enter a time via text box so 10:36.2 for example currently i have <?php if (($_POST["pb"] == "") || (!preg_match(???????, $_POST["pb"]))) { $error['pb'] = true; $print_again = true; $message = "The pb was not in time format.<br>"; } ?> but what would go in ??? to allow 1234567890 and ":" and "." Link to comment https://forums.phpfreaks.com/topic/122993-only-allowing-numbers-and-and-to-be-enerd-into-db/ Share on other sites More sharing options...
gaza165 Posted September 6, 2008 Share Posted September 6, 2008 You need to look at Regular Expressions... Redirect your post to the Regex Forum and they will help They are great guys... very knowledgable. G Link to comment https://forums.phpfreaks.com/topic/122993-only-allowing-numbers-and-and-to-be-enerd-into-db/#findComment-635124 Share on other sites More sharing options...
runnerjp Posted September 6, 2008 Author Share Posted September 6, 2008 would it be something like <?php if (($_POST["pb"] == "") || (eregi_replace("([0-9]:,.)") { $error['pb'] = true; $print_again = true; $message = "The pb was not in time format.<br>"; } ?> Link to comment https://forums.phpfreaks.com/topic/122993-only-allowing-numbers-and-and-to-be-enerd-into-db/#findComment-635127 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.