Toilets, pools or an open window on a rainy day can spell tragedy for any electronic device, including an iPhone. As soon as your iPhone gets wet, the most important thing to do is to dry its surface immediately and power it down. After that, you can try using a hair dryer, provided it's only water that your iPhone has been exposed to, not orange juice, soda or some other liquid. These measures may revive your iPhone, or they may not. In either case, your warranty is already void, so trying something is usually better than doing nothing at all.
Before Using a Hair Dryer
Dry off the surface of the iPhone immediately. Press the Sleep/Wake button and then drag the red slider to power it down. If the slider isn't working, keep trying. It may take several attempts until it powers down.
Using a Hair Dryer
Turn on a hair dryer at its lowest heat setting. Use the "Cool" setting if yours has one. Blow the iPhone with the hair dryer for an hour or two, changing its angle repeatedly. If the iPhone starts getting warm, turn off the hair dryer and let it cool down before resuming. Heat can be fatal to an iPhone. When you're done, leave the iPhone in a dry place for several days. Placing it in a zip-top bag submerged in uncooked rice or several packets of silica can draw remaining moisture from the iPhone.
Apple doesn't cover water damage, but some other warranty plans do. If you have a third-party warranty, for example from your cellular provider, check to see if it covers water damage before you try any home remedies.