title: Getting undefined offset in php
body: <p>I keep getting this notice when i run my code:</p>
  
  <pre><code>Notice: Undefined offset: 1 in C:\Users\Walid\xampp\htdocs\Inl3\Filmer-PHP.php on line 83
  </code></pre>
  
  <p>It complains on this line:</p>
  
  <pre><code>echo '&lt;li&gt;'.'&lt;a href="Filmer-PHP.php?name=' .$lineSplit[0].  '"&gt;'.$lineSplit[0].'&lt;span&gt;'.$lineSplit[1].'&lt;/span&gt;'.'&lt;/a&gt;'.'&lt;/li&gt;';
  </code></pre>
  
  <p>I think it complains on $lineSplit[1]. I cant really figure out why it complains, though the code works fine because it is a notice. But it is showing up on my screen and i dont know how to solve it. </p>
  
  <p>The full code:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  
  &lt;html&gt;
  
  &lt;head&gt;
  &lt;title&gt;Inlämning3&lt;/title&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;
  &lt;link rel="stylesheet" type="text/css" href="style.css"&gt;
  &lt;script type="text/javascript" src="jQuery.js" &gt;
  &lt;/script&gt;
  &lt;script type="text/javascript" src="valideraFilmer.js" &gt;
  &lt;/script&gt;
  
  
  &lt;/head&gt;
  
  &lt;body&gt;
  
  &lt;?php
  // Skriva film och info till en textfil
  if( isset ($_POST['name'])){
      $name = $_POST['name'];
      $grade = $_POST['options'];
      $link = $_POST['link'];
      $pic = $_POST['pic'];
      $story = $_POST['story'];
  
      $myFile = "filmer.txt";
      $handle = fopen($myFile, 'a');
  
      if(!empty($name)){
          fwrite($handle, $name. ";");
          fwrite($handle, $grade. ";");
          fwrite($handle, $link. ";");
          fwrite($handle, $pic. ";");
          fwrite($handle, $story. "\n");
          fclose($handle);
      }
  }
  ?&gt;
  
  &lt;div id="page"&gt;
      &lt;?php
          include("header.php");
      ?&gt;
      &lt;div id="leftbar"&gt;
          &lt;form id="form" method="post" action="Filmer-PHP.php" &gt;
              &lt;fieldset&gt;
                  &lt;legend&gt;Lägg till en film:&lt;/legend&gt;
                  Titel:
                  &lt;br&gt;&lt;input type="text" name="name" id="name"&gt;&lt;br&gt;
                  Betyg:
                  &lt;br&gt;&lt;select id="options" name="options"&gt;
                      &lt;option value="0"&gt;Välj betyg här...&lt;/option&gt;
                      &lt;option value="*"&gt; *&lt;/option&gt;
                      &lt;option value="**"&gt; **&lt;/option&gt;
                      &lt;option value="***"&gt; ***&lt;/option&gt;
                      &lt;option value="****"&gt; ****&lt;/option&gt;
                      &lt;option value="*****"&gt; *****&lt;/option&gt;                       
                  &lt;/select&gt;
                  &lt;br&gt;
                  Länk till imdb:
                  &lt;br&gt;&lt;input type="text" name="link" id="link"&gt;&lt;br&gt;
                  Länk till bild:
                  &lt;br&gt;&lt;input type="text" name="pic" id="pic"&gt;&lt;br&gt;
                  Filmens handling:
                  &lt;br&gt;&lt;textArea cols="20" rows="3" name="story" id="story"&gt;&lt;/textarea&gt;&lt;br&gt;
                  &lt;br&gt;&lt;input type="submit" name="button" value="Spara film" id="button"&gt;
              &lt;/fieldset&gt;
          &lt;/form&gt;
      &lt;/div&gt;
      &lt;div id="rightbar"&gt;
          &lt;h2&gt;Filmer&lt;/h2&gt;
  
          &lt;?php
          // Läsa av och visa titel och betyg
              $readin = file('filmer.txt');
              $ul = '&lt;ul id="films"&gt;';
              echo $ul;
              foreach($readin as $fName){
                  $lineSplit = explode(";", $fName);
                  echo '&lt;li&gt;'.'&lt;a href="Filmer-PHP.php?name=' .$lineSplit[0]. '"&gt;'.$lineSplit[0].'&lt;span&gt;'.$lineSplit[1].'&lt;/span&gt;'.'&lt;/a&gt;'.'&lt;/li&gt;';
              }
          ?&gt;
  
          &lt;?php
          // Läsa av och visa detaljerad info om filmer
              if(isset($_GET['name'])){
                  $name = $_GET['name'];
                  $readin = file('filmer.txt');
                  $lineSplit = explode(";", $name);
                  echo $name;
              }
          ?&gt;
  
      &lt;/div&gt;
          &lt;?php
              include("footer.php");
          ?&gt;
  &lt;/div&gt;
  
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>