If you are hitting a topped golf shot, the club head is striking the upper part of the ball. This connection with the top of the ball will produce a low flighted shot which does not travel as far is it would if struck correctly.
There are two ways that the club head is moving in order to hit the top of the golf ball. The club head is either being pulled up from the ground as it hits the ball and therefore it only connects with the top of the golf ball, or the club head is striking down too vertically and as a result of this, the club head strikes down on the top of the ball.
If we consider pulling the club head up away from the ground and the golf ball first, you need to check your grip pressure as you are swinging the golf club. If you are holding the golf club too tightly this will shorten the length of the muscles in your arms and effectively you will pull the club head up from the ground and hit the top of the ball.
Work on achieving a relaxed hold rather than squeezing the club.
Another reason that you can pull the club head up from the ground and strike the top of the golf ball is by bending your left arm (if you are a right handed golfer) through impact instead of keeping it straight. Make sure you start with your left arm straight and maintain this throughout your backswing. As you pull the club down towards the ball, keep your left arm straight as you strike and the club head will be at full extension from you allowing you to strike the ball correctly.
Keeping your posture and maintaining your spine angle throughout your golf swing will also stop you hitting topped golf shots. If you stand up and straighten your spine angle up during your backswing and/or downswing you will have effectively lifted the club head up away from the floor and as a result you will hit the top of the golf ball as you swing. To maintain your spine angle during your swing, place your golf club across your shoulders and then rotate your upper body to the right (for right handed golfers) as if making your golf swing. Work on pointing the left side of the golf club down towards the ball as you swing back and this will ensure you are maintaining your posture. If you stand up and lose your posture, you will find that the club becomes horizontal across your shoulders as you swing back.
You can also stop topping your golf shots by swinging the golf club more correctly around you. If you use your arms to lift the golf club up during your swing, rather than rotating your upper body during your backswing, you will swing the club very vertically and as a result the club head will attack down towards the ball and hit the top of it. Work on rotating your upper body to the right if you are right handed and turn your shoulders to 90 degrees right of their start position.
Doing this will result in the club swinging around you at a lower angle and you will swing back towards the ball from this lower position and strike lower down on the ball rather than top it.