I'm trying to figure out the correct syntax when trying to validate this line of code using intval ().
Code: Select all
$id = ereg_replace("[^0-9]", "", $_GET['id']); // filter everything but numbers for security
if ($id == "") {
echo "Missing Data to Run";
exit();
}http://whatsmyowncarworth.com/more-prac ... .php?id=10
Error message "Missing Data to Run"
(I think this is the correct way but my syntax is wrong. What's the correct syntax?)
Code: Select all
$id = $_GET['id'] = 1;
if (filter_var($id, FILTER_VALIDATE_INT) !== false)
{
echo "Missing Data to Run";
exit();
}