A good way to get rid of stains from carpet is to use some vinegar, Dawn Dish Soap or other dish soap and some water.
First vacuum the carpet to remove as much dirt as possible.
Then spray the carpet and stained areas with a mixture of water, vinegar and dish soap.
Use 1/4 cup of white vinegar, 1 tbsp. of Dawn dish soap, and fill with water.
Spray area liberally and let soak for 5-10 minutes and then proceed with blotting with a clean, dry towel until stain is removed.
Some carpet stain removal products can be of great benefit for combating many types of carpet stains.
Resolve Carpet cleaner is also a good product to remove stains from carpet.
Another way to get rid of stains from carpet is baking soda and vinegar.
Sprinkle a layer of dry baking soda on the stain.
Then, mix a cup of white vinegar with a cup of water and a few drops of dish soap in a spray bottle.
The vinegar will foam when it hits the baking soda which will clean the stain.
Leave it to sit for a few hours.