What to do with an iphone that does not restore?

SO my iphone will not restore. I have changed the battery and everything. It will only work when i plug it into the wall, and when i do it tells me to connect it to itunes and then i unplug it and it turns off, when i plug it into itunes i either get error code 21 or i get another one, and i don't know what else to do with it anymore… Please Help!

Have you tried DFU mode? Http://theiphonewiki.com/wiki/DFU_Mode