I had water damage from a hurricane a while back... this was not effecting the whole carpet, just a 5 foot section near a wall where the water leaked in, so take my advice with a grain of salt.
We pulled back the carpet from the tacks, vaccumed up as much moisture as we could get to with a wet vac and then put several fans RIGHT on the area to try to dry the section out. We left the carpet and the padding propped up so the air could circulate to the pad and underside of the carpet. We also cranked the A/C to help remove moisture. It took about 2 days for it to dry completely, but it seemed to be fine after.
You could always try, if it is a reasonably easy area to get to, pulling out the padding and put in new and make sure the carpet layer and the underfloor are DRY before retacking it down. Treat the carpet and the underfloor with a mildewcide like Microban. The padding itself doesn't have to look beautiful since it is under the carpet, so you can cut it with a box knife and fit it in there (pretty sure you can get it at most home improvement stores).
If it's more than a smaller section, I'd listen to the others' advice and just rip it all out and redo. You don't want a mold situation. I'd check your homeowners insurance to see if you're covered to get new carpet installed. Wouldn't turn in a claim unless you had a large amount of damage tho.
We've got engineered hardwood flooring now (I think that might be what bogart is referring to) and we love it. It's a thin veneer of real hardwood over a plywood sandwich of 5-7 layers. The layer system is stronger and able to resist warping much better than regular hardwood and laminate, and depending on the thickness of the hardwood layer, you can even get it refinished a few times, so it's supposed to last 50+ years. We have a concrete slab foundation, and the glue they use is supposed to also form a vapor (i.e. moisture) barrier so no more worrying about water seeping up through the slab either. It's not for everyone, but we're really happy with it.