To deal with the mildew in your carpet, start vacuuming it as soon as possible. Next, buy foam carpet shampoo from your local drugstore and apply some to the fabric. Leave it for at least 20 minutes before you rinse thoroughly.