title: form["x"] throws a KeyError
body: <p>I'm working on an assignment and we are to create a HTML order form then execute the info by python to create a second customer receipt. </p>
  
  <p>Here is the error msg:</p>
  
  <pre><code>Traceback (most recent call last):
    File "F:\Assignment 3\page.py", line 17, in &lt;module&gt;
      print "&lt;p&gt;Customer Name:", form["custName"].value, "&lt;/p&gt;"
    File "C:\Python27\lib\cgi.py", line 540, in __getitem__
      raise KeyError, key
  KeyError: 'custName'
  </code></pre>
  
  <p>THE HTML:</p>
  
  <pre><code>&lt;form action="page.py"&gt;
  
  &lt;div class="personalinfohead"&gt;
      &lt;p&gt;Personal Information:&lt;/p&gt;
  &lt;/div&gt;
  
  &lt;div class="personalinfo"&gt;
      &lt;div&gt;Full name:
          &lt;input type="text" name="custName" size="20" /&gt;
      &lt;/div&gt;
  
      &lt;div&gt;Email address:
          &lt;input type="text" name="custEmail"  size="50" /&gt;
      &lt;/div&gt;
  
      &lt;div&gt;Street address:
          &lt;input type="text" name="custAdd"  size="50" /&gt;
      &lt;/div&gt;
  
      &lt;div&gt;City:
          &lt;input type="text" name="custCity"  size="15" /&gt;
      &lt;/div&gt;
  
      &lt;div&gt;Province:
          &lt;input type="text" name="custProv"  size="2" maxlength="2" /&gt;
      &lt;/div&gt;
  
      &lt;div&gt;Postal code:
          &lt;input type="text" name="custPostal"  size="6" maxlength="6" /&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>PYTHON:</p>
  
  <pre><code>import cgi
  form = cgi.FieldStorage()
  
  # print HTTP/HTML header stuff
  print """Content-type: text/html
  
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
  &lt;html&gt;&lt;head&gt;
  &lt;title&gt;Order Form&lt;/title&gt;
  &lt;/head&gt;&lt;body&gt;
  """
  
  # print HTML body using form data
  print "&lt;h1&gt;Kintoro Japanese Bar &amp;amp; Restaurant&lt;/h1&gt;"
  print "&lt;h2&gt;Customer Reciept&lt;/h2&gt;"
  print "&lt;p&gt;Customer Name:", form["custName"].value, "&lt;/p&gt;"
  print "&lt;p&gt;Customer Email Address:", form["custEmail"].value, "&lt;/p&gt;"
  print "&lt;h2&gt;Customer Address:&lt;/h2&gt;"
  print "&lt;p&gt;Street:", form["custAdd"].value, "&lt;/p&gt;"
  print "&lt;p&gt;City:", form["custCity"].value, "&lt;/p&gt;"
  print "&lt;p&gt;Province:", form["custProv"].value, "&lt;/p&gt;"
  print "&lt;p&gt;Postal Code:", form["custPostal"].value, "&lt;/p&gt;"
  </code></pre>