title: Linking html, python and sql
body: <p>I'm trying to link html form with python and sql. My requirement is that the user gives an input and that input should be sent to some python function block to execute an sql statement on MS SQL Server and return the results back to the user. Please help in linking the below code :
  order.html </p>
  
  <pre><code>&lt;html&gt;
  &lt;form action="/order" method="POST"&gt;
  &lt;input type="text" name="month"&gt;
  &lt;input type="number" name="weekno"&gt;
  &lt;input type="submit"&gt;
  &lt;/form&gt;
  The stock for {{weekno}} is xyz
  &lt;/html&gt;
  </code></pre>
  
  <p>order.py :</p>
  
  <pre><code>from flask import Flask,render_template
  import sys
  
  app = Flask(__name__)
  
  @app.route('/order', method=['POST'])
  def orderdb() :
      # using sql server connection statement here
      cursor = connection.cursor ()
      cursor.execute ("select month,stock from salesdb where weeknumbr=?",weekno)
      return render_template('order.html',weekno = weekno)
  </code></pre>
  
  <p>This is a sample code i'm using here instead of pasting complete code.</p>
  
  <p>Please suggest the syntax to be used so that the query should take the weekno value from the form and execute the query based on weeknumbr condition.</p>
  
  <p>Thanks!!</p>