| 
 Posted by JackM on 06/19/84 11:44 
I'm still working on validating the phone numbers that are entered on a  
form but have come across a problem I don't understand how to fix. I can  
handle most instances when it's in regular US formats (555-555-5555 or  
(555) 555-5555 or 555 555 5555) but I'm having trouble when the entry is  
ten consecutive numbers with nothing else (5555555555). Not only does it  
not validate, but it shows as 2147483647 when I call the variable to  
check to see how it is set. I know I could break the form up into three  
values as in <input name="phone[area]"> <input name="phone[code]"> and  
<input name="phone[num]"> to eliminate that happening but I don't like  
the look of that and I know there's a better way that I haven't found. 
 
I tried googling for information on a preg_replace statement that could  
do what I need (check the phone number and add a space between the 3rd  
and 4th and the 6th and 7th digits if there isn't one there already) but  
I haven't been successful. 
 
What do I need to do to handle this?
 
  
Navigation:
[Reply to this message] 
 |