Author Topic: help on this please  (Read 478 times)

0 Members and 1 Guest are viewing this topic.

Offline ~n[EO]n~Topic starter

  • Devotee
  • Posts: 725
    • View Profile
help on this please
« on: October 04, 2007, 07:17:17 AM »
hi anybody knows how to validate form field for numbers, text etc... just one line example will do

Code: [Select]
if (empty($_REQUEST['co_telephone']))
$app->error('Please enter Telephone');
// i have validated like this but i only want to accept numbers 9 characters only, it only checks if it is blank or not

any help will be most welcome...

Offline jscix

  • Enthusiast
  • Posts: 197
    • View Profile
Re: help on this please
« Reply #1 on: October 04, 2007, 07:24:10 AM »
if (empty($_REQUEST['co_telephone']) || !(is_numeric($_REQUEST['co_telephone'])) || strlen($_REQUEST['co_telephone']) !== 9)
    {
           $app->error('Please enter Telephone');
    }