title: What's causing the mysql undefined index error with this tutorial script?
body: <p>I'm running this php script at my database verbatim from a tutorial, yet I'm getting an undefined index error on line 27 (the bit that starts with <code>if ($_REQUEST['action'] == "add") {</code>)... I'm just learning mysql so any help would rock!</p>
  
  <pre><code>&lt;?php
  /**
   * Copyright 2011 Robert Turrall - robertturrall.com
   *
   * Part of the video2brain course: Facebook Application Development: Learn by Video
   *
   * 
   */
  
  $dbhost     = 'localhost';      // This is the hostname/address for your database. Usually 127.0.0.1 for local testing, or 'localhost' is good
  $dbuser     = 'root';       // Login name to your database - anonymous is default for localhost MySQL
  $dbpass     = '';               // Login password to your database - default for local MySQL is no password
  $data       = 'test';           // Database name
  
  $db = mysql_connect($dbhost, $dbuser, $dbpass);
  
  if (mysql_errno() &gt; 0) {
      if (mysql_errno() == 1203) {
          // 1203 == ER_TOO_MANY_USER_CONNECTIONS (mysqld_error.h)
          die("DB error");
      } else {
          // other error
          die("DB error");
      }
  }
  
  if ($_REQUEST['action'] == "add") {
      mysql_select_db($data, $db);
      $Insert = "INSERT INTO FB_birthdays (UID, birthday) VALUES ('".$_REQUEST['uid']."', '".$_REQUEST['birthday']."')";
      $res = mysql_query($Insert, $db) or die ("Save error");
      mysql_close($db);
      echo "Added to DB!";
  }
  
  ?&gt;
  
  
  &lt;form action="savedb.php" method="post"&gt;
                  &lt;input type="hidden" name="request" value="add"&gt;
                  &lt;input type="hidden" name="uid" value="&lt;?php echo $user; ?&gt;"&gt;
                  &lt;input type="hidden" name="birthday" value="&lt;?php echo $birthday; ?&gt;"&gt;     
                  &lt;input name="Submit" type="submit" value="Add me!"&gt;
              &lt;/form&gt;
  </code></pre>