Python flask webpage single item page for multiple item
<p>I am doing a flask website project and im trying to get create an individual item page for each of my items. Im using sqlite for the database.</p>

<p>Below is the html code for my homepage:</p>

<pre><code>{% extends "base-template.html" %}

{% block content %}
&lt;h1&gt;Valves&lt;/h1&gt;
&lt;form action="/product-info" methods=["link", "post"] class="valve-box"&gt;


    {% for valve in valve_list %}
        &lt;li&gt;

            &lt;b&gt;Name/Model:&lt;/b&gt; {{ valve['item_name'] }}&lt;br&gt; &lt;b&gt;Price:&lt;/b&gt; {{     valve['item_price'] }}$
            &lt;input type="submit" value="Go to info page"/&gt;


        &lt;/li&gt; 
    {% endfor %}



&lt;/form&gt;
{% endblock %}
</code></pre>

<p>This on html is basically a verticle list of items. When i'm interested in an item, I press the button next to the item, and the routes file in my folder will takes me to the product-info page.</p>

<p>Below is html code for my product info page:</p>

<pre><code>{% extends "base-template.html" %}

{% block content %}
&lt;h1&gt;Information&lt;/h1&gt;

&lt;form class="valve-box"&gt;

    {% for valve in valve_list %}
        &lt;li&gt;

            &lt;b&gt;Item ID:&lt;/b&gt; {{ valve['item_id'] }}&lt;br&gt; &lt;b&gt;Name/Model:&lt;/b&gt; {{     valve['item_name'] }}&lt;br&gt; &lt;b&gt;Description:&lt;/b&gt; {{ valve['description'] }}&lt;br&gt;     &lt;b&gt;Price:&lt;/b&gt; {{ valve['item_price'] }}$



        &lt;/li&gt; 
    {% endfor %}


&lt;/form&gt;
{% endblock %}
</code></pre>

<p>The problem is i need a interactive product info page that only shows information of the product that the user was interested and pressed on. How can i do that?</p>

<p>Create a new <code>@app.route</code> in your Python file to display an individual product's information, and then add a link for each valve.  It could look like this:</p>

<pre><code>&lt;!-- other HTML up here --&gt;
{% for valve in valve_list %}
    &lt;li&gt;
        &lt;b&gt;Item ID:&lt;/b&gt; {{ valve['item_id'] }}&lt;br&gt; 
        &lt;b&gt;Name/Model:&lt;/b&gt; {{ valve['item_name'] }}&lt;br&gt; 
        &lt;b&gt;Description:&lt;/b&gt; {{ valve['description'] }}&lt;br&gt;     
        &lt;b&gt;Price:&lt;/b&gt; {{ valve['item_price'] }}$
        &lt;a href='{{ url_for("show_valve", valve_id=valve["item_id"]) }}'&gt;Show detail&lt;/a&gt;
    &lt;/li&gt; 
{% endfor %}
&lt;!-- the rest of your HTML --&gt;
</code></pre>

<p>Your new function in the Python file will accept the ID sent by your template, and you can then build a page just for that item.  Here's an example of what I'm thinking for your new function in the Python code:</p>

<pre><code>@app.route('whatever/address/you/want')
def show_valve(valve_id):
    # get your list of valves from wherever it comes from
    for valve in valves:
        if valve["item_id"] == valve_id:
            target_valve = valve
            break
    return render_template('showValveDetail.html', valve=target_valve)
</code></pre>

python html sqlite flask