I am trying to get dirname value on clicking the link of "More Photos". Here is the Form HTML.
<form action="/single" method="GET">
<input type="text" name="dirname" value="{{ dir_name }}" style="display:none">
<a href="single.html" class="btn btn-outline-white py-2 px-4">More Photos</a>
</form>
Here is the function in flask to get this data.
@app.route('/single.html', methods=['GET', 'POST'])
@app.route('/single', methods=['GET', 'POST'])
def single():
print(request.method)
if request.method == "GET":
dir_name = request.args.get("dirname")
print("Dir name is ", dir_name)
main_path = join("static/Downloaded_images", dir_name)
images_paths, names = get_paths(main_path)
return render_template('single.html', images_paths_names=zip(images_paths,names))
this is the URL when I click More photos. http://127.0.0.1:5000/single.html
How do I pass dirname in URL to get it in function? Currently it is showing me None.