Jump to content

Change code to account for multiple values in field


calebm12

Recommended Posts

I am using the following code to amend a value entered in a field prior to inserting in a database.  i am wondering how to change it so that if the field has multiple values (separted with comma or space) it will amend each value and not just the last one.

function citizenspeak_nodeapi(&$node, $op) {
  switch ($op) {
    case 'presave':
        $node->email_recipients = $node->email_recipients.'@metrofax.com';
  }
}

Sorry for my ignorance.  very green.  not sure how to mix that into the code

 

$pieces = explode(" ", $node->email_recipients);

foreach ($pieces as $node->email_recipients);

function citizenspeak_nodeapi(&$node, $op) {

  switch ($op) {

    case 'presave':

        $node->email_recipients = $node->email_recipients.'@metrofax.com';

  }

}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.