SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    323
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    is_numeric(changing to pop)

    hi, please i am trying to set a rule for if is_numeric, this was the way i did it.
    PHP Code:
    'Price' => array(
    'required' => true,
    'is_numeric' => true

    and in the validation script

    PHP Code:
    case 'is_numeric':
    if(
    $value != $rule_value) {
    $this->addError("{$item} must be a numeric value.");

    and i tried

    PHP Code:
    case 'is_numeric':
    if(
    $value != $source[$rule_value]) {
    $this->addError("{$item} must be a numeric value.");

    but its accepting any value as is_numeric and the error keeps coming up

  2. #2
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    323
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    this is what i used and its ok

    case 'is_numeric':
    if(is_numeric($value) != $rule_value) {
    $this->addError("{$item} must be a numeric value.");
    }


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •