If you enter the wrong passcode too many times on an iPhone, the phone will become "disabled," displaying a message that tells you to try again later. Eventually, your phone will become permanently disabled. In this case, the only way to use the iPhone again is to connect it to the last computer with which it synced and restore it to factory settings. This will erase all of your data, but you can immediately re-sync all the media, apps, contacts and other information that you have stored on your computer.
Connect your iPhone to the computer with which it was last synced using the USB docking cable.
Open iTunes if it does not open automatically. Click your iPhone's name on the left side of the iTunes window.
Click "Restore" in the center panel. Follow the prompts in the dialog box that appears. Leave your iPhone connected at all times.
Choose to set up your iPhone as a new phone when the restoration is complete. If you set it up from a backup, you will encounter the same passcode issues. Follow the prompts in the center panel to name and configure your iPhone.
Configure your syncing preferences by clicking the tabs at the top of the center panel. Click "Apply" when you have finished configuring the settings.
Write down your passcode in a safe place to avoid losing data through a restoration.