Reply LinkBack Thread Tools Search this Thread
Old 21-12-2007, 03:15   #21 (permalink)
Hunch
Grumpy old man
 
Hunch's Avatar
 
Join Date: Oct 2007
Location: North Japan
Posts: 1,737
By the way (sorry for the triple post) - if you just replace your ereg() or preg_match() line in your code with this one:

Code:
if(preg_match("/^[0-9]{3}-|\s[0-9]{3}-|\s[0-9]{4}$/", $number) || !$number) {
It'll match either numbers with dashes OR numbers with spaces in a single expression, so there's no need for the str_replace().
  Reply With Quote
Old 21-12-2007, 18:22   #22 (permalink)
Maciek
I like Iced Tea
 
Maciek's Avatar
 
Join Date: Nov 2007
Location: Kitchener.Ontario.Canada
Posts: 116
Send a message via MSN to Maciek
sorry, but where do I place
PHP Code:
str_replace("-"" "$htelephone); // 

Im not sure... =(
  Reply With Quote
Old 21-12-2007, 18:31   #23 (permalink)
Maciek
I like Iced Tea
 
Maciek's Avatar
 
Join Date: Nov 2007
Location: Kitchener.Ontario.Canada
Posts: 116
Send a message via MSN to Maciek
Ohh never mind!! i figured it out! =)!!!! Thanks hunch!!! and the "-" and " " should have been the other way around. Thanks sooo much! it works like a charm. Im beggining to love php. lol.
  Reply With Quote
Old 21-12-2007, 19:05   #24 (permalink)
Maciek
I like Iced Tea
 
Maciek's Avatar
 
Join Date: Nov 2007
Location: Kitchener.Ontario.Canada
Posts: 116
Send a message via MSN to Maciek
ONE MORE QUESTION ABOUT THIS!. What if the person had the option of putting stuff in the text field or not! Example "Fax Number: 111-111-1111"

And it was optional. So if the person did not fill that field in, it would not validate it! but if the person did, it would validate it as a legible phone number. How is this done?
  Reply With Quote
Old 21-12-2007, 19:46   #25 (permalink)
Kaklz
Rock it out.
 
Kaklz's Avatar
 
Join Date: Dec 2007
Posts: 209
just make a separate text box for notes or comments. Much simpler.
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8