Preg_match_all unknown problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kingdm
Forum Commoner
Posts: 27
Joined: Thu Dec 03, 2009 9:32 am

Preg_match_all unknown problem

Post by kingdm »

Good day.

I have a preg_match_all created so that I can validate my input in a form, which I only requires number (0-9), alphabets (a-z or A - Z) and the dash (-).

Code: Select all

if(preg_match_all('/[^a-z0-9-]/i', $db_marinanumber, $invalid))   
        {   
           $errors[] = "Your Marina license number contains invalid character: " . join('',array_unique($invalid[0]));   
        }
I get an error, even if I input the correct input. Example, the correct input is 10813-91839-23 or A1239-123A-23 something like that. No spaces.

I still get the errors and the errors says blank a whitespace character. But I don't have any on that in my input. Why is that?
kingdm
Forum Commoner
Posts: 27
Joined: Thu Dec 03, 2009 9:32 am

Re: Preg_match_all unknown problem

Post by kingdm »

Sorry for posting, it works after I close my browser. Why is that?
Post Reply