Answer the question
In order to leave comments, you need to log in
How can I make the first option in type="radio" in the array be selected by default?
There is an array
<?php foreach ($ar as $key => $value) { ?>
<?php ($value == $valueq) ? $selected = ' active' : $selected=''; ?>
<label for="<?php echo $id . '-' . $value; ?>" class="tleft">
<input type="radio" id="<?php echo $id . '-' . $value; ?>" name="<?php echo $name; ?>" value="<?php echo $value; ?>" <?php if ($valueq == $value) { ?>checked="checked"<?php }?>>
<?php echo $key; ?>
</label>
<?php } ?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question