A
Anonymous
Guest
I have a form with and if elseif statement and I'm trying to validate the phone number and eventually the Social Securtiy number first by determining if the field is empty then is there are actual numbers. I was trying the phone number first and when I test the form the php gets stuck on validating the phone number. My code looks like this:
if ($this->fname == ""){$this->error = 1;}
elseif ($this->lname == ""){$this->error = 2;}
elseif ($this->ssNum == ""){$this->error = 3;}
elseif ($this->addr1 == ""){$this->error = 4;}
elseif ($this->city == ""){$this->error = 5;}
elseif ($this->state == ""){$this->error = 6;}
elseif ($this->zip == ""){$this->error = 7;}
elseif ($this->phone == ""){$this->error = 8;}
elseif ($this->phone != "('/^\d{3,3}-?\d{3,3}-?\d{4,4}$/', $phone)"){$this->error = 8;}
How should I handle the phone number validation in this example.
Thanks,
Rob
if ($this->fname == ""){$this->error = 1;}
elseif ($this->lname == ""){$this->error = 2;}
elseif ($this->ssNum == ""){$this->error = 3;}
elseif ($this->addr1 == ""){$this->error = 4;}
elseif ($this->city == ""){$this->error = 5;}
elseif ($this->state == ""){$this->error = 6;}
elseif ($this->zip == ""){$this->error = 7;}
elseif ($this->phone == ""){$this->error = 8;}
elseif ($this->phone != "('/^\d{3,3}-?\d{3,3}-?\d{4,4}$/', $phone)"){$this->error = 8;}
How should I handle the phone number validation in this example.
Thanks,
Rob