Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 17th, 2012  |  syntax: None  |  size: 1.67 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. PHP Error: Undefined index: event_list when I think its already defined.
  2. <?php include('functions.php'); ?>
  3.  
  4. <?php
  5.  $yr = $_GET['year_list'];
  6.  $evnt = $_GET['event_list'];
  7. ?>
  8.  
  9. <html>
  10. <head>
  11.  <script type="text/javascript" src="myscripts.js"></script>
  12. </head>
  13. <body>
  14.  <div>
  15.   <form name="myform" >
  16.    Select Year: <?php echo hspacer(1); ?>
  17.    <select id="year_list" name="year_list">
  18.    <?php  
  19.     for($year = (date('Y') - 100); $year <= (date('Y') + 100); $year++ ) {
  20.      if ($year == date('Y'))  echo "<option value='$year' name='$year' selected='' >" . $year . "</option>";
  21.      else echo "<option value='$year' name='$year' >" . $year . "</option>";
  22.     }
  23.    ?>
  24.    </select>
  25.    <?php echo hspacer(5); ?>
  26.    Select Event:  <?php echo hspacer(1); ?>
  27.    <select id="event_list" name="event_list" >
  28.    <?php  
  29.     $events = array("Karate Tournament", "Beauty Pageant", "Film Festival", "Singing Contest", "Wedding");
  30.  
  31.     foreach($events as $event) echo "<option value='$event' name='$event' >" . $event . "</option>";
  32.    ?>
  33.    </select>
  34.    <?php echo vspacer(2); echo hspacer(22); ?>
  35.    <input type="submit" id="add_description" name="add_description" value="Add Description" onclick=""/>
  36.   </form>
  37.  </div>
  38. </body>
  39. </html>
  40.        
  41. <?php
  42.  function hspacer($num_of_spaces) {
  43.   $spaces = "";
  44.   if ($num_of_spaces > 0)  for($i=0; $i<$num_of_spaces; $i++ )  $spaces .= "&nbsp;";
  45.  
  46.   return $spaces;
  47.  }
  48.  
  49.  function vspacer($num_of_linefeeds) {
  50.   $linefeeds = "";
  51.   if ($num_of_linefeeds > 0)  for($i=0; $i<$num_of_linefeeds; $i++ )  $linefeeds .= "<br />";
  52.  
  53.   return $linefeeds;
  54.  }
  55. ?>
  56.        
  57. $yr = isset($_GET['year_list']) ? $_GET['year_list'] : null;
  58. $evnt = isset($_GET['event_list']) ? $_GET['event_list'] : null;