Hi,
I have a simple form with a text field
and I want to check if it was written there a integer.
I used is_numeric($_POST["input"]) but it accepts also double number.
What can I do?
Hi,
I have a simple form with a text field
and I want to check if it was written there a integer.
I used is_numeric($_POST["input"]) but it accepts also double number.
What can I do?
use regular expression matching.
PHP Code:if(!preg_match("/^[\-\+]?[\d]*$/",$_POST["input"]))
{
//error
}
The following pages might be helpful:
PHP Form Validation Script
and
JavaScript Form Validation
Bookmarks