title: Undefined Index Error - Wordpress Functions
body: <p>Receiving a few errors when trying to edit my custom posts in the admin area. </p>
  
  <p>Notice: Undefined index: phone in functions.php on line 146</p>
  
  <p>Undefined index: phone in functions.php on line 130</p>
  
  <pre><code>function landing_details(){ 
  global $post; 
  if ( defined('DOING_AUTOSAVE') &amp;&amp; DOING_AUTOSAVE ) return $post_id;
  $custom = get_post_custom($post-&gt;ID); 
  $phone = $custom["phone"][0]; 
  ?&gt; 
  &lt;p&gt;&lt;label style="width: 100px; display: inline-block;"&gt;Phone Number:&lt;/label&gt; &lt;input         name="phone" value="&lt;?php echo $phone; ?&gt;" size="50"/&gt;&lt;/p&gt;
  &lt;?php }
  }
  </code></pre>
  
  <p>Line 130 being <code>$phone = $custom["phone"][0];</code></p>
  
  <pre><code>//Add post saving
  add_action('save_post', 'save_details');
  function save_details(){
  global $post;
  if ( defined('DOING_AUTOSAVE') &amp;&amp; DOING_AUTOSAVE ){   
      return $post_id;  
  }else{ 
  update_post_meta($post['ID'], "phone", $_POST["phone"]);
  
  }
  }
  </code></pre>
  
  <p>Line 146 being <code>update_post_meta($post['ID'], "phone", $_POST["phone"]);</code></p>
  
  <p>Any help would be much appreciated. Im very new to this and this alone has taken me forever to figure out!</p>
  
  <p><strong>RESOLVED</strong>  at least no more errors returning!</p>
  
  <pre><code>function landing_details(){ 
  global $post; 
  if ( defined('DOING_AUTOSAVE') &amp;&amp; DOING_AUTOSAVE ) return $post_id;
  $custom = get_post_custom($post-&gt;ID); 
  if (isset($_POST['phone'])) return
  $phone = $custom["phone"][0]; 
  ?&gt; 
  &lt;p&gt;&lt;label style="width: 100px; display: inline-block;"&gt;Phone Number:&lt;/label&gt; &lt;input   name="phone" value="&lt;?php if (isset($_POST['phone'])) { echo ($_POST['phone']); } ?&gt;"  size="50"/&gt;&lt;/p&gt;
  &lt;?php }
  }
  </code></pre>
  
  <p>Next Block</p>
  
  <pre><code>//Add post saving
  add_action('save_post', 'save_details');
  function save_details(){
  global $post;
  if ( defined('DOING_AUTOSAVE') &amp;&amp; DOING_AUTOSAVE ){   
      return $post_id;  
   }else{ 
  if (!empty($phone))
  
   update_post_meta($post['ID'], "phone", $_POST["phone"]);
  
  }
  }
  </code></pre>
  
  <p>If this was not the correct approach please let me know as i am trying to learn best practices!!! thanks!</p>
  
  <p><strong>New Issue</strong></p>
  
  <p>Now the value isnt showing in the text box if the custom post has a value entered.....</p>