Good hand position, option 1: In these pictures (above), the left hand supports the weight of the trumpet with the index finger. The ring finger is available to extend the third valve slide, and the thumb operates the first valve slide. Players with small hands may choose to place both the ring finger and the pinky in the third-slide ring so as to facilitate triggering. (I played for years with only my pinky in the third-slide ring, because my other fingers were too small to reach.) Notice that the fingers of the right hand are curved on top of the valves, and the pinky is out of the hook. Most band directors prefer this position for beginning students.
Good hand position, option 2 (above): In this variation, the right hand stays the same but the left hand has moved so that the ring finger and pinky finger grip the valve casings below the third valve slide. The weight of the instrument now rests upon the ring finger of the left hand, which can be preferable for students with large hands. This position must not cause the left wrist to bend unnaturally, lest the blood vessels become too constricted. However, the slight change in the angle of the horn can serve to subtly shift the angle at which the mouthpiece hits the face, and may be more comfortable for some players.
My hand position, option 3 (above): In fact, many teachers would consider this to be poor hand position, because of the collapsed right hand. There is a school of thought that says that the pinky finger should never enter the hook, lest the player use it as leverage to press the trumpet harder into the face. I find, however, that I can eliminate this risk through good air support, appropriate air speed, and a well-developed embouchure, and I do not prevent my students from adopting this hand position. The weight of the trumpet is more evenly distributed across the right pinky and thumb and the fingers of the left hand, which allows the me (and my students) to shift the weight as needed when extending the first and third slides and prevents undue strain on the left wrist. (I personally place both my left index and middle finger in the ring, and leave my ring finger and pinky below the third slide, but as this photo demonstrates, variations are possible.)
A common problem: This hand position (above) places the fingers of the right hand flat across the valves, which can lead to fingering errors during technical passages. In order for the fingers to move quickly, they must be arched atop the finger buttons. (I personally have found that rapid finger motion depends on the arch of the fingers moreso than whether the pinky is in the hook.)