Variable not working in sidebar loop

The $post object is not available outside the Loop, unless you globalize it before referencing it:

global $post;
$variable = $post->post_title;

tech