Validate phone with explode

BSmith001 - October 27, 2008 - 22:51

I have a txt box the takes phone numbers, ie: ph, ph, ph as a format.
Now I need to explode them into an array and send each one to the validation module
$qlist = explode(",", $QuikList)
if (!validate_phone($qlist)) {
form_set_error('', t('Please provide a valid mobile phone number.'));
}

but, do I need a foreach? I don't seem to be looping thru the array

...

mooffie - October 28, 2008 - 15:17

Try:

$qlist = explode(",", $QuikList)
foreach ($qlist as $phone) {
  if (!validate_phone($phone)) {
    form_set_error('', t('Please provide a valid mobile phone number.'));
  }
}

 
 

Drupal is a registered trademark of Dries Buytaert.