PHP Error: Undefined index: event_list when I think its already defined.
<p>I am a complete noob in PHP and programming as well. I am very new to programming so my question might look stupid, but please be patient.</p>

<p>I am having an undefined index error in which I think its already defined. </p>

<p>I have here the codes.</p>

<p><b><code>index.php</code></b></p>

<pre><code>&lt;?php include('functions.php'); ?&gt;

&lt;?php 
 $yr = $_GET['year_list'];
 $evnt = $_GET['event_list']; 
?&gt;

&lt;html&gt;
&lt;head&gt;
 &lt;script type="text/javascript" src="myscripts.js"&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
 &lt;div&gt;
  &lt;form name="myform" &gt;
   Select Year: &lt;?php echo hspacer(1); ?&gt;
   &lt;select id="year_list" name="year_list"&gt;
   &lt;?php  
    for($year = (date('Y') - 100); $year &lt;= (date('Y') + 100); $year++ ) {
     if ($year == date('Y'))  echo "&lt;option value='$year' name='$year' selected='' &gt;" . $year . "&lt;/option&gt;";
     else echo "&lt;option value='$year' name='$year' &gt;" . $year . "&lt;/option&gt;";
    }
   ?&gt;
   &lt;/select&gt;
   &lt;?php echo hspacer(5); ?&gt;
   Select Event:  &lt;?php echo hspacer(1); ?&gt;
   &lt;select id="event_list" name="event_list" &gt;
   &lt;?php  
    $events = array("Karate Tournament", "Beauty Pageant", "Film Festival", "Singing Contest", "Wedding");

    foreach($events as $event) echo "&lt;option value='$event' name='$event' &gt;" . $event . "&lt;/option&gt;";
   ?&gt;
   &lt;/select&gt;
   &lt;?php echo vspacer(2); echo hspacer(22); ?&gt;
   &lt;input type="submit" id="add_description" name="add_description" value="Add Description" onclick=""/&gt; 
  &lt;/form&gt;
 &lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p><br /></p>

<p><b><code>functions.php</code></b></p>

<pre><code>&lt;?php
 function hspacer($num_of_spaces) {
  $spaces = "";
  if ($num_of_spaces &gt; 0)  for($i=0; $i&lt;$num_of_spaces; $i++ )  $spaces .= "&amp;nbsp;";

  return $spaces;
 }

 function vspacer($num_of_linefeeds) {
  $linefeeds = "";
  if ($num_of_linefeeds &gt; 0)  for($i=0; $i&lt;$num_of_linefeeds; $i++ )  $linefeeds .= "&lt;br /&gt;";

  return $linefeeds;
 }
?&gt;
</code></pre>

<p>What I don't understand about this, is that I think when you declared an element with an ID you can use the ID as index for <code>$_GET</code> or <code>$_POST</code>. Secondly, why is it that the second element (<code>event_list</code>) is not recognized when they have the same declaration as the first element which is (<code>year_list</code>).  I'm confused with the inconsistency. Only the second element is not recognized while the other first one is recognized. Can somebody please explain to me in a simple way that a beginner like me can understand.</p>
