I just found a new way to handle selected radio buttons…
The problem
I have some 5-10 radio options (only one is selectable). i select and save the value.
now when showing the form again how do i select the previously selected radio again?
Common solution
compare the saved value 5-10 times with the values of radio options and echo checked=”checked” where matched
Uncommon solution [did it myself
]
eg/
<code>
<input name=”backup_what” type=”radio” value=”full” /> Full backup (wp-content folder and Database)
<input name=”backup_what” type=”radio” value=”db” /> Only Database
<input name=”backup_what” type=”radio” value=”content” /> Only wp-content folder
</code>
get the selected value in a variable say $radio_val
now to use php’s versatility
$$radio_val = ‘checked=”checked”‘;
notice the double $… what it does is it will make a new variable like $full or $db or $content depending on the value saved
then just echo respective values in the radio options
<input name=”backup_what” type=”radio” value=”full” <?php echo $full; ?> /> Full backup (wp-content folder and Database)
<input name=”backup_what” type=”radio” value=”db” <?php echo $db; ?> /> Only Database
<input name=”backup_what” type=”radio” value=”content” <?php echo $content; ?> /> Only wp-content folder
Please use and try to find more uses of this if possible…
cheers….
VN:F [1.9.13_1145]
Rating: +5 (from 5 votes)
Nitun 7:44 am on January 27, 2012 Permalink | Log in to Reply
Reference link : http://kb.mediatemple.net/questions/793/Why+is+allow_url_fopen+disabled+on+the+%28gs%29+Grid-Service%3F