The question here might be repeated, but I was not able to get a solution from any material available online. I am trying to get the value of the Selected Dropdown list as a string, So that later based on the selected item I can select the type of plot to be displayed. But I'm getting a 'form' error.
HTML code of the form:
        <form action="{{ url_for('visualize') }}" method="GET">
            Select one from the given options:
            <select name="plots">
                <option value="{{Selected_plot[0]}}" selected>{{Selected_plot[0]}}</option>
                {% for plots in Selected_plot[1:] %}
                <option value="{{plots}}">{{plots}}</option>
                {% endfor %}
            </select>
            <input type="submit" value="Submit" />
        </form>
python code :
@app.route('/')
def home():
    Selected_plot = ['Scatter plot', 'Line Plot','Box Plot']
    return render_template('homepage.html' )
@app.route('/visualize', methods=['POST', 'GET'] )
def visualize():
    """Renders the contact page."""
    if request.method == "GET":
        plot_selected = str(request.form['plots'])
    if plot_selected ==  'Scatter plot':
        #Scatter plot code 
    elif plot_selected ==  'Line Plot':
        # Line plot code
    else:
        # Box plot code 
Thanks to the Community in advance.
 
    