How can I check if some checkboxes in HTML are checked?
<p>In am making a webpage in flask on which users can choose between several options. Depending on these options I want to show them their choosen options in the next page.
My HTML code:</p>

<pre><code>&lt;input type="checkbox" name="name1"&gt;name1&lt;br&gt;
&lt;input type="checkbox" name="name2"&gt;name2&lt;br&gt;
&lt;input type="checkbox" name="name3"&gt;name3&lt;br&gt;
</code></pre>

<p>My Python code:</p>

<pre><code>if checkbox 1 is checked:
    do something
if checkbox 2 is checked:
    do something different
if checkbox 3 is checked:
    do another something different
</code></pre>

<p>I cannot find how to form these if-statements. I found something with:</p>

<pre><code>.getvalue
</code></pre>

<p>But then I got an error. With radio-buttons I can get it to work. When I name them all the same and give them different values with:</p>

<pre><code>option = request.form['name']
</code></pre>

<p>However, this does also not work with checkboxes, as then it only remembers the last checkbox, but I want them all.</p>