How do i give a radio button during my wordpress widget form? I've been in a position to add input fields that will get saved and works fine. However I am getting challenge with radiobuttons. Anybody?

This really is my code for input area:

<p><label for="<?php echo $this->get_field_id('id'); ?>"><?php _e('Video ID:'); ?> 
    <input class="widefat" id="<?php echo $this->get_field_id('id');  ?>" 
    name="<?php echo $this->get_field_name('id'); ?>" 
    type="text" value="<?php echo $id; ?>" /></label></p>

which is my radio button

<input type="radio" name="video_size" value="small"> Small<br>
    <input type="radio" name="video_size" value="full" checked> Full 

Create each radio button and make certain they're underneath the same "group". This is a fundamental HTML version of what you would like.

<input type="radio" name="group1" value="small" checked>Small<br />
<input type="radio" name="group1" value="full"> Full<br />

Be aware from the name="group1" -- this groups the 2 choices together so that you can choose either. checked marks the default selection once the radio buttons load.

The WordPress version of the will need some logic to check on what choose the consumer makes. You will have to see if small or full is chosen and also have it supplement the checked attribute accordingly.

For example

if($size == 'Full')
{
     echo '<input type="radio" name="group1" value="small">Small<br />' . "\n";
     echo '<input type="radio" name="group1" value="full" checked> Full<br />' . "\n";
     //This will out put the radio buttons with Full chosen if the user selected it previously.
}
else
{
     echo '<input type="radio" name="group1" value="small" checked>Small<br />' . "\n";
     echo '<input type="radio" name="group1" value="full"> Full<br />' . "\n";
     //This will out put the radio buttons with Small selected as default/user selected.
}

i attempted by using this however it doesent save my selection.. i suppose i dont get in which the var $size originated from within this script?

My problem would be that the radio buttons wont stay checked.. i attempted using the if / else solution.. only one seletion stay checked.. (i understand that logicly its strange)

My code is a component of the widget i'm building (wordpress widget)...

here's my code:

        <!-- Your Name: Text Input -->
    <?php if( $visiblecategories == showempty ) { ?>
    <p>
        <label for="<?php echo $this->get_field_id( 'visiblecategories' ); ?>"><?php _e('Show Empty Category:', 'badcategory'); ?></label><br />
        <input type="radio" id="<?php echo $this->get_field_id( 'visiblecategories' ); ?>" name="<?php echo $this->get_field_name( 'visiblecategories' ); ?>" value="showempty" style="" checked /> Show Empty<br />
        <input type="radio" id="<?php echo $this->get_field_id( 'visiblecategories' ); ?>" name="<?php echo $this->get_field_name( 'visiblecategories' ); ?>" value="hideempty" style="" /> Hide Empty<br />            
    </p>
    <?php } else { ?>
    <?php echo $visiblecategories; ?>
    <p>
        <label for="<?php echo $this->get_field_id( 'visiblecategories' ); ?>"><?php _e('Show Empty Category:', 'badcategory'); ?></label><br />
        <input type="radio" id="<?php echo $this->get_field_id( 'visiblecategories' ); ?>" name="<?php echo $this->get_field_name( 'visiblecategories' ); ?>" value="showempty" style="" /> Show Empty<br />
        <input type="radio" id="<?php echo $this->get_field_id( 'visiblecategories' ); ?>" name="<?php echo $this->get_field_name( 'visiblecategories' ); ?>" value="hideempty" style="" checked /> Hide Empty<br />            
    </p>
    <?php } ?>