Hi,
I have the following code to create a list of radio buttons.
What I want is when a particular radio button is selected and a form is submitted I would like the users selected choice to be rememberd.
{exp:channel:categories category_group="7" show="not 54"}
<input type="radio" name="categories[]" value="{category_id}" {checked}> {category_name}
{/exp:channel:categories}
I can’t seem to find out how to acheive this. Could someone please point me in the right direction.
Thanks
Wayne.
Hi, Thanks for suggestion, I’ve tried it and it’s not keeping the radio button check after submitting the form.
I have managed to get what I need by enabling PHP in the tempate and using the code below.
if(isset($_POST['submit'])){
$selected_val = $_POST['categories']; // Storing Selected Value In Variable
}else{
$selected_val = "46";
<input type="radio" name="categories" value="{category_id}"<?php if($selected_val == {category_id}) echo" checked" ?>> {category_name}
}
Am I missing something or should this be possible natively?
Thanks
For that purpose, if you want to avoid PHP in the template you may want to check out Mo’ Variables
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.