title: Python/Flask, request ID from dropdownlist populated options with SQLite
body: <p>I'm trying to get the IDs selected with a dropdown and add it to my table without the use of JSON but I keep getting the same error :</p>
  
  <blockquote>
    <p>werkzeug.exceptions.HTTPException.wrap..newcls: 400 Bad
    Request: KeyError: 'nomFabri'</p>
  </blockquote>
  
  <p>I have three tables:
  <a href="https://i.stack.imgur.com/W7v7x.png" rel="nofollow noreferrer">https://i.stack.imgur.com/W7v7x.png</a> 
  (can't post image yet, sadly)</p>
  
  <p>Thought it would work fine and tried to mess around with my columns, without much success. Most of what I got from my researchs are to use JSON isn't there a workaround without using it ?</p>
  
  <p>Here the code</p>
  
  <pre class="lang-py prettyprint-override"><code>@bp.route('/Appareil', methods=['GET', 'POST'])
  def Appareil():
      db = get_db()
      materielTypes = db.execute(
         'SELECT * FROM t_type'
      ).fetchall()
      fabriquants = db.execute(
          'SELECT * FROM t_fabriquant'
      ).fetchall()
      return render_template('materiel/appareil.html',
      materielTypes=materielTypes, fabriquants=fabriquants)
  
  @bp.route('/AddAppareil', methods=['GET', 'POST'])
  def AddAppareil():
      if request.method == 'POST':
          nomModele = request.form['nomModele']
          numeroProduit = request.form['numeroProduit']
          nomFabri = request.form['nomFabri']
          matType = request.form['matType']
          error = None
      if not nomModele:
          error = 'Faux.'
      if error is not None:
          flash(error)
      else:
          db = get_db()
          db.execute(
              'INSERT INTO t_appareil (nomModele, numeroProduit, nomFabri, mattype)'
              ' VALUES (?, ?, ?, ?)',
              (nomModele, numeroProduit, nomFabri, matType,)
          )
          db.commit()
          return redirect(url_for('materiel.appareil'))
      return render_template('materiel/appareil.html')
  </code></pre>
  
  <p>And here the form</p>
  
  <pre><code>{% extends 'base.html' %}
  
  {% block header %}
    &lt;h1&gt;{% block title %}nouvel appareil{% endblock %}&lt;/h1&gt;
  {% endblock %}
  
  {% block content %}
    &lt;form method="post" class="insertdata" action="/AddAppareil"&gt;
      &lt;select&gt;
        {% for materielType in materielTypes %}
        &lt;option name="matType" id="matType" value="{{ request.form['id_type'] }}"&gt;{{ materielType['materielType'] }}&lt;/option&gt;
        {% endfor %}
      &lt;/select&gt;
      &lt;select&gt;
          {% for fabriquant in fabriquants %}
          &lt;option name="nomFabri" id="nomFabri" value="{{ request.form['id_fabriquant']] }}"&gt;{{ fabriquant['nomFabr'] }}&lt;/option&gt;
          {% endfor %}
        &lt;/select&gt;
      &lt;input type="text" name="nomModele" id="nomModele" placeholder="nom du Modele" value="{{ request.form['nomModele'] }}" required&gt;
      &lt;input type="text" name="numeroProduit" id="numeroProduit" placeholder="Numéro de série" value="{{ request.form['numeroProduit'] }}" required&gt;
      &lt;input type="submit" value="Save"&gt;
    &lt;/form&gt;
  {% endblock %}
  </code></pre>
  
  <p>Thanks for any help provided :)</p>