[Python] How do I get the text value of a selected option in django views.py

Discussão em 'Python' iniciado por Stack, Março 18, 2025.

  1. Stack

    Stack Membro Participativo

    For example: if first option Regular is selected then how can i get the value "1" and its text value "Regular" in views.py

    <form method = "post" action = "{% url 'index' %}">
    {% csrf_token %}
    <select name = "drop1" >
    <option value="1">Regular</option>
    <option value="2">Medium</option>
    <option value="3">Large</option>
    </select>
    <input type = "submit" value="Submit">

    Continue reading...

Compartilhe esta Página