+ 1

HTML Sending user's choice to database

Hello, I have a question regarding a multiple-choice question that appeared in a Coding Foundation exam. The MCQ is about sending users' choices to a database, and it provides a code snippet that is missing something to complete the task. The code: <form> <input type="radio" id="r1"> <label for="r1">Cash</label> <input type="radio" id="r2"> <label for="r2">Card</label> </form> Answers: 1. Value attributes 2. Name attributes 3. A submit button Currently, all three answers are shown as correct, but isn't the value the input given by the user and therefore not necessary to be explicitly written in the code, or am I misunderstanding something here? Thanks for the help!

17th Feb 2024, 9:43 AM
Ovid Lorenz
Ovid Lorenz - avatar
3 Answers
+ 4
The values represented by the radio inputs must be written in the code. The user can only click on the choices, there is no other way the user can provide the values. He can only pick and choose from values already coded into the radio inputs. https://www.w3schools.com/tags/att_input_type_radio.asp
17th Feb 2024, 11:07 AM
Bob_Li
Bob_Li - avatar
+ 4
In this form, after all, there is no field for entering data, only a choice of two radio stations. Therefore, the value must be specified in them.
17th Feb 2024, 11:17 AM
Solo
Solo - avatar
+ 1
Thanks a lot guys!
17th Feb 2024, 3:48 PM
Ovid Lorenz
Ovid Lorenz - avatar