Web Design Help
It's free to register, to post a question or to start / join a discussion
phone number verification filter
Likes # 0
Posted August 13, 2009 at 7:18PM
In my PHP form handler I use this filter
//CHECK THAT NO TEXT HAS BEEN ENTERED IN THE PHONE FIELD
if (!is_numeric($phone)){
header ("Location: $errorphoneurl");
exit ;
}
However, many people tend to include spaces, how can my filter also accept spaces?
Regards
Awestruck
Likes # 0
Posted August 14, 2009 at 2:23AM
I can't give an exact answer (i've only recently started learning PHP myself!), but click here looks like it should do what you want...search for "blank" strings and replace with nothing.
hope it works for you!
Likes # 0
Posted August 17, 2009 at 10:01PM
remove all the spaces with:
$phone=str_replace(' ',',$phone);
Likes # 0
Posted August 18, 2009 at 11:05PM
OTT_Buzzard your suggestion was not suitable but it showed me an excellent PHP resource. Thank you.
tobyb121, your suggestion did the trick. Many thanks.
Best wishes
Awestruck
Reply to this topic
This thread has been locked.
Check out PC Advisor's other tech forums
Top 5 Most Popular
-
Samsung Galaxy S4 vs iPhone 5 vs HTC One comparison review
-
New iPhone 5S, iPhone 6 release date UK: When will the new iPhone arrive?
-
Samsung Galaxy S4 vs Apple iPhone 5 comparison review
-
iPhone 5 review - Apple's iPhone remains a beautifully built, top performer
-
Galaxy S4 vs BlackBerry Z10 comparison review - which is best, the Samsung or the BlackBerry?



