Use the Settings API. A look at my latest plugin may help you to understand how to register a save
function for your fields. Most relevant excerpt:
/**
* Register custom settings for the fields.
*
* @see save_settings()
* @see print_input_field()
* @return void
*/
public function add_contact_fields()
{
register_setting(
'general',
$this->option_name,
array ( $this, 'save_settings' )
);
foreach ( $this->fields as $type => $desc )
{
$handle = $this->option_name . "_$type";
$args = array (
'label_for' => $handle,
'type' => $type
);
$callback = array ( $this, 'print_input_field' );
add_settings_field(
$handle,
$desc,
$callback,
'general',
'default',
$args
);
}
}
/**
* Callback for 'register_setting()'.
*
* @see add_contact_fields()
* @param array $settings
* @return array $settings
*/
public function save_settings( array $settings = array () )
{
$default = get_option( $this->option_name );
$settings = array_map( 'trim', $settings );
$settings = $this->prepare_mail_save( $settings, $default );
$settings = $this->prepare_phone_save( $settings );
return $settings;
}
And … welcome to WordPress Stack Exchange!