Question: I want to change the value of the flask variable

when the user clicks on the link.

Something like that

(I tried this way but of it does not work)

```
<a href="#" onclick=" {% set data = true %}">sutfile</a>

```

Because later on I have the following loop that I want to fill the select tag

only when the boolean = true

```
<label>vCenterAddress:<select> {% if data == true %} {% for a in vCenterAddress %} <option value="">{{ a[0] }}</option> {% endfor %} {% endif %}</select></label>

```

the boolean pass in the route.py

```
@app.route("/", methods=['GET', 'POST'])

    def index():
        cur = mysql.connection.cursor()
        vCenterAddress = cur.execute(f"SELECT DISTINCT vCenterAddress FROM linux0 where vCenterAddress <> \"None\" ")
        vCenterAddress = cur.fetchall()
        data_to_show: bool = False
        return render_template('index.html', vCenterAddress=vCenterAddress, data=data_to_show)

```

Answer: 
You need to make your flask server "listen" to your url app page

so you need to import request

like this:

```
from flask import request

```

And now in your `def index():` you need to add

```
var_name = request.args.get('var_name') = true

```

Your html link

```
<a href="#" onClick="location="yourpage?var_bame==true">sutfile</a>

```

Now when you click on the link the new url is yourPage with var name=true

and in the flask server your var=true and your if condition will work

```
<label>vCenterAddress:<select> {% if data == true %} {% for a in vCenterAddress %} <option value="">{{ a[0] }}</option> {% endfor %} {% endif %}</select></label>

```
here is a more detailed explanation of what I suggested in the comment

1. change the link's href:

```html
<!-- when a user clicks this it will load yourpage.com?show_data=true -->
<a href="?show_data=true">sutfile</a>

```

2. Get the parameter you defined in flask

```py
## you need flask's request module to access the request parameters
from flask import request

@app.route("/", methods=['GET', 'POST'])
def index():
   # this will be False by default, and True if the show_data url parameter is "true"
   show_data = request.args.get('show_data') == "true"

   # You can now use that value as any other in your template.
   # Also, I would suggest renaming "data"
   # To someone who reads your code, it looks like this variable contains
   # data, when it's actually just a boolean to show/hide the data.
   return render_template('index.html', data=show_data)

```