Created
April 27, 2019 07:49
-
-
Save sahanh/7a28e9757edfe7e9fb14a1d383f9c3dd to your computer and use it in GitHub Desktop.
Formatting phone number url for calendly
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
<?php | |
/** | |
* [email protected] | |
*/ | |
$inputs = (array) $_GET; | |
$clPath = isset($_GET["calendly"]) ? $_GET["calendly"] : null; | |
$phoneField = isset($_GET["phone"]) ? $_GET["phone"] : null; | |
$final = []; | |
foreach ($inputs as $inputField => $input) { | |
if ($phoneField == $inputField) { | |
$final[$inputField] = str_replace("+", "", trim($input)); | |
} else { | |
$final[$inputField] = $input; | |
} | |
} | |
$query = http_build_query($final); | |
header("Location: https://calendly.com/{$clPath}?{$query}"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment