I have the following code in HTML
<label class="radio-inline">
<input type="radio" name="movimiento" value="Venta">Venta</label>
<label class="radio-inline">
<input type="radio" name="movimiento" value="Renta" required> Renta </label>
<label class="radio-inline">
<input type="radio" name="movimiento" value="Traspaso"> Traspaso </label>
And I have a database that is loaded with its respective data, how can I preselect the checkbox that is entered in the database? That is, if in the database I select Sale, how can the Sale checkbox appear selected?
To set the selected radio button by default, you must use the checked attribute :
The attribute
checked
can be on elements<input type="checkbox">
and<input type="radio">
.Use the attribute
checked
as indicated in this answer .Example: