Page 1 of 1

A Radio button question

Posted: Fri Mar 05, 2010 10:13 am
by PastorHank
In my database I have a field that shows the status of a person. It has a single character "A" for active, "I" for inactive. What I am trying to do is when a person's record is retrieved if the status is "A" i want to show a radio button with the label 'Active' as checked. If I understand things correctly the 'value' of a radio button is the label and not if it's checked or unchecked, is that correct and if so, how do I tell the radio button to show itself as checked? I've found lots of examples on putting a value on the screen but nothing about what I'm trying to do.

thanks

Re: A Radio button question

Posted: Fri Mar 05, 2010 11:24 am
by Reviresco

Code: Select all

<input type="radio" name="status" value="active"<?php if($status == 'A') { echo ' checked="checked"';}?> />

Re: A Radio button question

Posted: Fri Mar 05, 2010 11:32 am
by PastorHank
Reviresco wrote:

Code: Select all

<input type="radio" name="status" value="active"<?php if($status == 'A') { echo ' checked="checked"';}?> />
that's way too simple :) thank you