title: Undefined offset: 7 in /home/test/index.php
body: <p>I am struggling with the undefined notice comes and sometimes not. I am not sure why I am having this error.</p>
  
  <pre><code>foreach($_POST['toplevel_menus'] as $toplevel_menu){
      $toplevel_extracted = explode("|", $toplevel_menu);
      $submenu_id = $toplevel_extracted[5];
      if(isset($_POST[$submenu_id]) &amp;&amp; !empty($_POST[$submenu_id])){
          foreach($_POST[$submenu_id] as $submenu){ 
              $extracted = explode("|" $submenu); 
              $submenu_name = (isset($_POST[$subname][$extracted[1]])) 
                                 ? trim($_POST[$subname][$extracted[1]])
                                 : "";                                                                       
           }
       }
  }
  </code></pre>
  
  <p>The line number 7 is </p>
  
  <pre><code>$submenu_name = (isset($_POST[$subname][$extracted[1]])) ? trim($_POST[$subname][$extracted[1]]) : "";  
  </code></pre>