Yay! I don't know why it worked, but it did. I ran through Apple's protocol to fix it and nothing happened. I had just one DNS listed, so I deleted it. It came back. Deleted again, and this time a typed in one from my MacBook that was connected to the network. It worked! Thanks.
I have O2 broadband, I have the same issue. After entering the wifi password, I clicked on the blue button to see the IP address. It was starting with 169.xxx.xxx.xxx and no DNS. It should be 192.xxx.xxx.xxx
I looged into the Router "http://192.168.1.254/" in case of O2 and may differ by different providers. I saw the encryption password was different to what I typed in IPhone. What I saw in IE was the original password came with my router. I hooked the problem was, Once a laptop or other devices once connected to the router and if the router is reseted to factory settings, it connects to wifi without changing the password again. where we try the Iphone with the password which was once configured for the router. So the wifi is connected but not the internet. After changing the password, I got the internet immed. I also changed the cannel in the configuration page, but I beleive it does not matter.
Anybdy having this problem can check your password is correct. My Iphone connects to the Wifi even I type the old password once configured to the router and resetted to factory settings. If this is your case, This will solve the problem.