You should move the (second) form tag inside the loop.
With your current code, multiple fields with same name are generated inside the same form tag. When this form is submitted, only one of the value (first one i.e. 0
) is sent.
<!-- Following is currently generated by your template. -->
<form action="edit" method="POST">
<input type="hidden" name="filen" value="0">
...other fields here...
<input type="hidden" name="filen" value="1">
...and so on...
</form>
What you want is different form block for every video.
<!-- Following is what it should be. -->
<form action="edit" method="POST">
<input type="hidden" name="filen" value="0">
...other fields here...
</form>
<form action="edit" method="POST">
<input type="hidden" name="filen" value="1">
...other fields here...
</form>
So, to fix your code for the second form-
<h2> Playback List </h2>
{% set counter = 0 -%}
{% for items in playlist %}
<form action="edit" method="POST" >
{{ items }}
<input type="hidden" name="filen" value="{{ counter + loop.index0 }}">
<input type="submit" name="editype" value="up">
<input type="submit" name="editype" value="down">
<input type="submit" name="editype" value="delete">
</form>
<br>
{% endfor %}
<form action="edit" method="POST" >
<input type="submit" name="editype" value="Next Video">
<input type="submit" name="editype" value="Reset">
</form>