Reputation:
I have this for loop and I want just one radio button to be selected from all of this 99.
for($x = 2; $x <= 101; $x++){
$out .= "<img src='/img/channel_icons/".$icons[$x]."' class='channel-icons' title='".$icons[$x]."' alt='".$icons[$x]."' width='20px' height='20px' >";
$out .= "<input type='radio' value='icon'>";
}
I can select multiple radio buttons, but I want to enable user to select just one of them. Could anyone help me with this ? Could I do this using radio buttons or I need to use something else ? Checkboxes ? Could I do this without using javascript or I have to use it ?
Newbie in frontEnd stuff.
Upvotes: 0
Views: 69
Reputation: 7175
add name of the radio button to group these button
for($x = 2; $x <= 101; $x++){
$out .= "<img src='/img/channel_icons/".$icons[$x]."' class='channel-icons' title='".$icons[$x]."' alt='".$icons[$x]."' width='20px' height='20px' >";
$out .= "<input type='radio' value='icon' name='sample'>";
}
Upvotes: 2