A cell phone that shuts off while plugged into the charger will not recharge. The problem may be rooted in the charger but it's also possible that the phone itself is damaged.
Signs that are indicative of this problem include: the phone powering off when the device is first plugged in, the phone powering off after a few minutes or hours on the charger or a phone that shuts down and won't power up after being released from the charger. One must also be sure that it's not simply the phone's screen turning off which is normal and expected with many phones. A powered-off phone cannot be accessed (no buttons will work) unless the "Power" button is turned back on.
Video of the Day
There are a couple things that must be considered to determine what exactly is causing the problem. If you're using a charger that's not manufactured for your phone it's possible that you've damaged the phone's port (the place where the cord plugs in).
The most effective solution to the problem is simply to purchase or borrow a new charger made for your phone. If the new charger also causes the phone to shut down when plugged in, it means the problem lies within the phone, not the charger.