Default headset problem

When i put the headset on the jack the music is not playing on the earphones.instead it is playing on the rear stereo.What i did is that i reformat my phone.Tried to play music with the headset on,works perfectly fine.but everytime i put the headset on my phone it doesnt recognize headset icon on top.and the volume on my headset is not working.tried to use my headphones on other samsung phones it works just fine.badly need your help.thanks.