I am trying to add a feature to my web which is using an icon, so I have put some icons from font awesome inside a button
<button id="iconDiv1" class="iconBtn" type="button" value="fa-solid fa-heart fa-xl" >
<i class="fa-solid fa-heart fa-2xl" class="icons"></i>
</button>
<button id="iconDiv2" class="iconBtn" type="button" value="fa-solid fa-gamepad fa-xl">
<i class="fa-solid fa-gamepad fa-2xl" class="icons">
</i></button>
<button id="iconDiv3" class="iconBtn" type="button" value="fa-solid fa-chess-knight fa-xl">
<i class="fa-solid fa-chess-knight fa-2xl" class="icons"></i>
</button>
<button id="iconDiv4" class="iconBtn" type="button" value="fa-solid fa-hand-fist fa-xl">
<i class="fa-solid fa-hand-fist fa-2xl" class="icons"></i>
</button>
<button id="iconDiv5" class="iconBtn" type="button" value="fa-solid fa-mug-hot fa-xl">
<i class="fa-solid fa-mug-hot fa-2xl" class="icons"></i>
</button>
and I've add a name attribute to the selected button/icon using javascripte, now I need to add the button value value="fa-solid fa-heart fa-xl (which is the same icon class inside of it) to a database using flask
but I don't know how to get the button value attribute in just flask without using javascripte
I've searched a lot for the answer, but I didn't find anything, and I've also tried to write
icon = request.form.get("selected").getattr("value) and it didn't word so I tried to write
icon = request.form["selected].__getattribure__("value") in flask but it also didn't word.
Values of input fields and buttons within a form can be obtained using the name attribute. Other attributes cannot be accessed by the server.
So you can use an attribute
namefor the buttons.If the form is sent, the value of the attribute
valuemust be requested based on the name attribute.