Fingers falling flat. When playing a chord, you need to keep your fingers somewhat squared, with your two joints making a box in which the fingerboard is the fourth side. Check on your ring finger in particular: on a D chord it probably wants to flatten out at the first joint, which means it is now muting the high string. That is, even if you’re fretting the high string just right, the underside of your ring finger may be muffling it. Squaring up your ring finger should help.
Too far from the fret. “Put your index finger at the second fret” really means, “place your index finger between the first fret and the second fret.” You don’t want to put your finger down on the string right over the second fret, but you can’t leave it too far back toward the first fret either. The ideal location is about three-quarters of the way toward the second fret. Of course, there will be some variation of finger placement, especially on a chord such as D where more than one finger has to be at the same fret (on different strings) at the same time.
Not pressing down hard enough. This one is tricky. You actually don’t need to press down forcefully to make a note sound, and in fact you can build up a lot of unnecessary tension and pain in your hand, not to mention your fingertips, by pressing too hard out of concentration or stress. But you do need to make sure that your effort is evenly distributed over all your fingers in the chord, and if you’ve already checked for slanted, muffling fingers and how close they are to the right fret, check on how much pressure you’re applying to hold down each string.