Passing values ββfrom one html page to another via Flask (Python)
My web app currently has 3 pages. I got user input on the first page, which I passed to my view.py, and figured out some variables that I need for my second page. I want to pass variables that exist on my second page to the third page, but I don't know how. Any suggestions on how to change the html for the 2nd page to achieve this?
So far I have been solving this problem by creating global variables my.py. This seems to work, but does not seem to be a viable long term solution.
Thank!
existing variables: thePrediction, theData
html for the second page:
<div class = "caption-full">
<h3>Currently, I have a {{thePercentage}} chance of getting adopted.</h3>
{% if thePrediction[1] + thePrediction[2] >0%}
<form action="/third_page" method="GET">
<button class="btn btn-large btn-info" >Go to third page</button>
</form>
{% endif %}
</div>
+3
source to share
1 answer
I think I figured it out:
<div class = "caption-full">
<h3>Currently, I have a {{thePercentage}} chance of getting adopted.</h3>
{% if thePrediction[1] + thePrediction[2] >0%}
<form action="/third_page" method="GET">
<input type="hidden" name="alignment" value="{{thePassedValue}}" />
<button class="btn btn-large btn-info" >Go to third page</button>
</form>
{% endif %}
</div>
0
source to share