Created
August 23, 2013 15:18
-
-
Save overwine/6320511 to your computer and use it in GitHub Desktop.
Herpa, derpa.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$phone = $entry["5"]; | |
function format_phone($phone) { | |
$phone = preg_replace("/[^0-9]/", "", $phone); | |
if (strlen($phone) == 7) { | |
return preg_replace("/([0-9]{3})([0-9]{4})/", "$2 $3", $phone); | |
} elseif (strlen($phone) == 10) { | |
return preg_replace("/([0-9]{3})([0-9]{3})([0-9]{4})/", "$1 $2 $3", $phone); | |
} else { | |
return $phone; | |
} | |
} | |
format_phone($phone); | |
$body = array( | |
'event' => 'saveRequest', | |
'type' => 'contact', | |
'encSource' => 13641, | |
'patient.firstName' => $entry["1.3"], | |
'patient.lastName' => $entry["1.6"], | |
'patient.sex' => $entry["2"], | |
'patient.email' => $entry["3"], | |
'patient.address1' => $entry["4.1"], | |
'patient.city' => $entry["4.3"], | |
'patient.state' => $entry["4.4"], | |
'patient.zipPostal' => $entry["4.5"], | |
'patient.homeAreacode' => $1, | |
'homeNumberA' => $2, | |
'homeNumberB' => $3, | |
'category' => 'brochureRequest', | |
'comment' => 'free-form text', | |
'patient.languagePref' => $entry["6"] | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment