1👍
First of all Selcuk is right, you shall build your question better. Questions shall be as objective as possible and yours is quite vague. Yet, i can see where your issue lies.
You confused JavaScript with HTML Forms. They’re two separate specifications which aim to be independent from each other. Before building a JavaScript powered form you should first build the form in pure HTML, and once that works you shall add JavaScript on top of it.
For your issue at hand you used the mar
name as a JavaScript variable name, which will never be sent by the HTML form because HTML forms are not aware of JavaScript variables. Instead you shall use the name=
parameter on your select
tags as follows:
<br>
<select id="m" name="mar">
<option value="">Марка</option>
{% for article in articles %}
<option value="{{ article }}">{{ article }}</option>
{% endfor %}
</select>
</td>
<td style="text-align:center">
<br>
<select id="y" name="yer">
<option value="">Год выпуска</option>
<option value="2016">2016</option>
</select>
</td>
<td style="text-align:center">
<br>
<select id="k" name="kpp">
<option value="">Коробка передач</option>
<option value="mt">Механика</option>
</select>
</td>
The HTML form will send the mar
variable with the option of whatever article was selected from the dropdown.
Note
That code style might be okay for learning django and/or web development in general but in the real world you shall delegate the construction of the form to django, in a file often called forms.py
. Django has a form engine that gives much better compatibility than hardcoding a form in the template.