Send SMS to phone - php form removing ( ) and - from the phone number submitted -


i have script found online, trying 10 digit phone number , adding mobile provider send email sms.

it works. but...

my front end form automatically inputing "(", ")" , "-" parentheses , dashes make more phone number. php script isn't working because have send email none of that, 0,1,2,3,4,5,6,7,8,9 works.

you can see front end form here. http://busetopizza.com/demo/index.php clicking "send phone"

you notice send (516)-233-2333 submission.

i need rewriting code toto strip out characters, re-evaluate send 5162332333.

attached php code.. can done????

<?php if (!isset($_post['submit'])){error("must use form here!");} $ph = $_post['10digit']; $carrier = $_post['carrier']; switch ($carrier){     case 'att':         $to = $ph . '@txt.att.net';         break;     case 'metropcs':         $to = $ph . '@mymetropcs.com';         break;     case 'nextel':         $to = $ph . '@messaging.nextel.com';         break;     case 'sprint':         $to = $ph . '@messaging.sprintpcs.com';         break;     case 'tmobile':         $to = $ph . '@tmomail.net';         break;     case 'verizon':         $to = $ph . '@vtext.com';         break;     case 'virgin':         $to = $ph . '@vmobl.com';         break;           default:         error("no carrier selected, message not sent!"); } $message = "http://www.busetopizza.com/"; $subject = "send phone app"; $from = "admin@messtudios.com"; mail($to, $subject, $message, $from); echo "your message has been sent!"; exit(); function error($msg){     echo "an error has occurred: ".$msg;     exit(); } ?> 

edit following line use regular expression find , replace non-digit characters in input.

$ph = preg_replace('/[^[:digit:]]/', '', $_post['10digit']); 

Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -