Restarting your phone can clear glitches and help it reconnect to Wi-Fi.
If your phone still won't connect, then it's time to do some resetting. In the Settings app, go to "General Management." There, tap "Reset." ... Your phone will restart — Try connecting To Wi-Fi again