My guess is you picked out not enough water and too much sun right away, but those are only two of the potential culprits. In reality, all four can cause plant wilt, in addition to disease, poor root growth, low temperatures, and incorrect fertilization.
During the heat of summer, many garden plants show their discomfort by sagging and losing the rigidity in their stems and leaves. It makes the plant look sad and evokes the same emotion in gardeners. Wilting is caused by a reduction of water in the plant cells. Many people know this so the first reaction of many gardeners is to add water to “make the plant better” whenever they see it wilting. Without full analysis you may actually harm the plant with that course of action.
When a plant senses a harsh and potentially harmful condition, like excessive sunlight and heat, the stomata will close, effectively shutting down the conveyor system and no more water flows to the plant structure. The result is what we interpret as wilt. This is not necessarily a bad thing. The plant is in protection mode. It's trying to keep water in its cells by limiting what it loses to the air. Once conditions improve, like less heat, the stomata open up again and the flow resumes. The plant is erect again.
Wilting is a perfectly normal reaction to the stress of the day. Many plants droop in the afternoon and pop back into shape as the sun moves lower in the sky. It doesn't harm the plant and as long as other conditions are fine, there's nothing you should do to "fix" it.
That's why analysis is needed with wilting plants. Stick your finger in the soil during the hot summer day when you see wilting. If the soil is still moist, or at least not bone dry, it is normal and the plant is just taking a break from dry and hot air. There's enough moisture in the soil for the roots, the plant is choosing to shut down transpiration to avoid excessive moisture loss. No extra water from you is needed and the plant will bounce back later.
If your finger reveals a complete lack of moisture, it may be time to water. That won't reverse the wilt immediately, but will add much-needed water to the soil. The plant probably closed its stomata normally because of the hot day and that same heat dried out the soil. When it's ready to resume transpiration the stomata will open and it will begin drawing moisture from the soil. In that case, watering when you see wilt and dry soil can help.
Too little sunlight can cause a similar plant reaction. Some plants may wilt when they aren't receiving enough sunlight because stomata also play a role in photosynthesis. Watering wilting plants in the shade may be inducing a situation where you add too much water to the roots. In this case knowing your plants becomes important. Sun-loving plants shouldn't be planted in the shade.
If there isn't enough water in the soil and roots to replace what is lost through transpiration when the stomata do open again, the wilting can reach the point where the physical structure of the plant cells are damaged. In that case, watering will not reverse the wilting; the plant is not able to revitalize the damaged tissue. This is when the wilted leaves turn brown and die. If enough leaves and plant tissue is lost the plant will die.
Cold temperatures can also cause the same type of tissue damage. In the fall, cold nights cause wilting and eventually the cold causes cell damage. Brown leaves and dead plants mark the end of the season.
A couple other factors are over-fertilization and disease. When you apply too much fertilizer you can create an imbalance in the plant's growth rate forcing the roots and stomata to work themselves to death; the root structure may not be able to support the plant growth and the lack of water movement causes wilting.
Some plant diseases cause wilt (often seen in tomatoes); there are usually other signs associated with this type of wilt and sprays and powders that can help when you identify it. If your soil is good, your water practice is good, and the plant doesn't recover under cool conditions, the wilting may be due to a fungal disease. Researching the plant, and it's susceptibility to wilting diseases, can help you take appropriate control measures.
There are a few things you can do to reduce harmful wilting. The best control is maintaining consistent soil conditions. If an organically-enriched soil is constantly at an appropriate moisture level through efficient watering and mulching practices, the plant will have the water when it needs it.You won't need to worry about plant damage even when the plant looks stressed during the heat of summer.
Knowing your plants and selecting heat and sun loving plants for hot and dry conditions is good. Plants that have a natural tolerance to heat stress may show no sign of wilting even in extreme conditions. Xeric plants are in this category. Plant tags, plant catalogs, and online resources will often identify how much sun and how much water a plant requires. Matching the plant with the appropriate location is always the best planting practice.
Most importantly, don't automatically reach for the garden hose when you see wilting. In addition to the root issues I discussed above, spraying the leaves can cool the air temperature and cause the stomata to open. If there isn't enough moisture accumulated in the roots or soil, you will force the plant to lose water from its cells and that may be enough to cause irreparable damage.
Once you understand wilting and realize it's nothing that requires overreaction, you can relax and actually enjoy watching the natural process. Seeing a plant recover from the sad state of wilt to a fully erect display of health in just a few hours is an amazing thing.