I have been out of the programming game for a while now and I've tried to implement an old script I created but now have an error saying the eregi() function was removed and it throws an error. How would I re-write this now:
I tried this with preg_match but it's no bueno. Need to check if the string is a number basically:
NATE
Code:
if (empty ($_POST["var"]) || !eregi ("^[0-9]+$", $_POST["var"]))
[indent]{
// validation failed
}[/indent]
I tried this with preg_match but it's no bueno. Need to check if the string is a number basically:
Code:
$str = "7856";
$pattern = "^[0-9]+$";
if (preg_match($pattern, $str))
{
echo 'val passed';
}
else
{
echo 'val failed - string is not a number';
}
NATE