Title: Undefined index first_name, last_name
Last modified: August 22, 2016

---

# Undefined index first_name, last_name

 *  [KLicheR](https://wordpress.org/support/users/klicher/)
 * (@klicher)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/undefined-index-first_name-last_name/)
 * Here’s a patch:
 *     ```
       From 6b26b8dd44ee87b3cd97434694f7adccedd98862 Mon Sep 17 00:00:00 2001
       From: Kristoffer LR <kristoffer.lr@gmail.com>
       Date: Fri, 5 Sep 2014 16:03:06 -0400
       Subject: [PATCH] Fix undefined index errors relative to optionnal first and
        last name.
   
       ---
        lib/ns_widget_mailchimp.class.php | 6 ++++--
        1 file changed, 4 insertions(+), 2 deletions(-)
   
       diff --git a/lib/ns_widget_mailchimp.class.php b/lib/ns_widget_mailchimp.class.php
       index bbef5f4..3129f75 100644
       --- a/lib/ns_widget_mailchimp.class.php
       +++ b/lib/ns_widget_mailchimp.class.php
       @@ -191,14 +191,16 @@ class NS_Widget_MailChimp extends WP_Widget {
        				return false;
   
        			}
       +
       +			$merge_vars = array();
   
       -			if (is_string($_POST[$this->id_base . '_first_name'])  && '' != $_POST[$this->id_base . '_first_name']) {
       +			if (!empty($_POST[$this->id_base . '_first_name']) && is_string($_POST[$this->id_base . '_first_name'])) {
   
        				$merge_vars['FNAME'] = strip_tags($_POST[$this->id_base . '_first_name']);
   
        			}
   
       -			if (is_string($_POST[$this->id_base . '_last_name']) && '' != $_POST[$this->id_base . '_last_name']) {
       +			if (!empty($_POST[$this->id_base . '_last_name']) && is_string($_POST[$this->id_base . '_last_name'])) {
   
        				$merge_vars['LNAME'] = strip_tags($_POST[$this->id_base . '_last_name']);
   
       --
       1.8.5.2
       ```
   
 * [https://wordpress.org/plugins/mailchimp-widget/](https://wordpress.org/plugins/mailchimp-widget/)

The topic ‘Undefined index first_name, last_name’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/mailchimp-widget.svg)
 * [MailChimp Widget](https://wordpress.org/plugins/mailchimp-widget/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/mailchimp-widget/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/mailchimp-widget/)
 * [Active Topics](https://wordpress.org/support/plugin/mailchimp-widget/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/mailchimp-widget/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/mailchimp-widget/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [KLicheR](https://wordpress.org/support/users/klicher/)
 * Last activity: [11 years, 7 months ago](https://wordpress.org/support/topic/undefined-index-first_name-last_name/)
 * Status: not resolved