xious Posted April 15, 2006 Share Posted April 15, 2006 I have a contact info database with Yes/No radio buttons. I have added a link to edit each entry, and on that link, all the fields are filled with the current values. However, I do not know how to have the radio buttons checked with the current values. How would I do that? I have all the text fields filled out with the echo commands, but I don't know how to change the radio buttons. Any info would be appreciated.X Link to comment https://forums.phpfreaks.com/topic/7491-recalling-radio-button-data/ Share on other sites More sharing options...
Orio Posted April 15, 2006 Share Posted April 15, 2006 In order to make a radio button checked you have to add "checked="checked"" to the radio button tag.This will do the job:[code]<?php//Let's say 'yes' is 1 and 'no' is 0if($radio == 0){$radiotext = "";};elseif($radio == 1){$radiotext = 'checked="checked"';};?><input type="radio" name="yesno" <?php echo($radiotext); ?>>[/code]Hope it helps :)Orio. Link to comment https://forums.phpfreaks.com/topic/7491-recalling-radio-button-data/#findComment-27314 Share on other sites More sharing options...
xious Posted April 15, 2006 Author Share Posted April 15, 2006 That's sort of what I needed, but the radio buttons are multiple (Yes, No, and Maybe), not just checked for Yes, unchecked for no. So how would I do it that way? I think I would have to use different variables, but it is not liking either my variables or my syntax. Link to comment https://forums.phpfreaks.com/topic/7491-recalling-radio-button-data/#findComment-27327 Share on other sites More sharing options...
xious Posted April 15, 2006 Author Share Posted April 15, 2006 I ended up getting it. Thanks for giving me a starting point Orio. Link to comment https://forums.phpfreaks.com/topic/7491-recalling-radio-button-data/#findComment-27332 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.