How to get select value in flask?

I'm trying to get the value of select tag but it returns none, how can I get the value of it using flask? I tried request.form.get but still not working, It says the value is none.

Here's the HTML of my select tag

 <select name="channels" id="channels" method="POST">
        <option value="1">Channel 1</option>
        <option value="2">Channel 2</option>
        <option value="3">Channel 3</option>
        <option value="4">Channel 4</option>
        <option value="5">Channel 5</option>
        <option value="6">Channel 6</option>
        <option value="7">Channel 7</option>
        <option value="8">Channel 8</option>
      </select>   

Here's my flask code:

def updatedecimal():
    con = sqlite3.connect('/home/tim-rtc/Randomizer/tmonitor.db')
    con.row_factory = sqlite3.Row

    channel = request.form.get('channels')
    
    cur = con.cursor()
    cur.execute("""SELECT * FROM monitors where CHANNEL = ?  ORDER BY id DESC limit 1""", (channel, ))

    rows = cur.fetchall()
    
    row1 = [row[1] for row in rows]
    row2 = [row[2] for row in rows]
    row3 = [row[3] for row in rows]
    
    
    return jsonify( row1 = row1, row2 = row2, row3 = row3)

Newbie in flask here. Thank you!

Back to Top