Water and electricity do not work well together. An iPhone can be seriously damaged if it has been submerged or exposed to water. If you've dropped your iPhone in water, be sure to turn it off as soon as possible and begin to dry it out. If you keep your iPhone turned on once it has been exposed to liquid, it could suffer permanent damage.
Consider the Liquid
Non-chlorinated water will probably cause the least amount of damage once your iPhone has been exposed, but it can still be permanent. Soda, beer, any type of alcohol and pool water can also cause corrosion because of the sugar it contains. Salt and sea water can damage the circuitry in a very short amount of time, so you may want to seek professional repair if your iPhone has been exposed to anything other than water. Apple's Applecare insurance policy does not cover liquid damage.
Take the Phone Apart
Once your iPhone has been exposed or submerged in water, retrieve the device as quickly as possible and power it down. Once the device is turned off, dry off the front, back and sides of the exterior. Gently shake the phone and try to remove any excess water. If your iPhone has a SIM card tray, remove the SIM card and the tray and dry them off completely. If you have experience removing the front and back casing from your iPhone, removing them may help speed up the drying process. Keep in mind this can also void the warranty, so when in doubt, check with the manufacturer.
Try the Rice Trick
ZDNet recommends placing the iPhone in a vacuum-sealed bag filled with either rice or silica gel and sealing it shut for 24 to 48 hours. The dry rice or silica gel can help remove moisture and liquid from within the iPhone that would otherwise stay trapped and cause corrosion. Although there is no guarantee this method will work, it's worth trying -- it's cheaper than bringing your iPhone to your wireless carrier or Apple for repair or replacement right off the bat.
Turn it Back On
Once you've given the device a day or two to dry out, try to power it back on again. If there is no permanent damage the phone should power up correctly. Ensure all the features are still working including the touchscreen, volume controls, home button and earphone jack. Water exposure can cause long-term problems with the battery, and symptoms may not appear until months later. If you notice any of the iPhone's features are not working correctly, take the device to your wireless carrier or local Apple Store for repairs or replacement.