My iphone 4s turns on while charging, but once on it turns off
Sounds like a bad battery to me. You can get a new battery and everything you need to change it at a website called iFixit for like $30 shipped, (don't worry, for a 4S, a battery replacement is super easy, it's just 4 screws and pulling the battery connector off of the logic board).