Created
July 2, 2012 21:15
-
-
Save cam-gists/3035738 to your computer and use it in GitHub Desktop.
PHP: Validate Vars
This file contains hidden or 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 | |
// Check Range of Value | |
$value = filter_input(INPUT_GET, "value", FILTER_VALIDATE_INT, | |
array("options" => array("min_range" => 15, "max_range" => 20))); | |
if ($value) { | |
// run my code | |
} | |
else { | |
// handle the issue | |
} | |
// Validate Email | |
$email = filter_var($email, FILTER_VALIDATE_EMAIL); | |
if ($email !== false) { | |
mail($email, "Here is my email", "Some Content"); | |
} | |
else { | |
// handle the issue invalid email address | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment