Where are you adding this shortcode? In php template or in post editor? post editor can not process php code. To pass variable you have to add this in php template or anywhere where php code can be parsed. If you add in php template let me know full code of this shortcode so that i can correct for you if you have any error.