You can plug it into the computer you normally sync with, if you've synced while the passcode was enabled, & your phone should sync/backup. You can then restore from this backup.
If you have not synced, while this passcode was enabled:
Either force the phone into recovery mode, as described here, & restore it:
http://support.apple.com/kb/ht1808
Or, login to iCloud.com, locate the phone, then erase it.
Either method will remove the passcode.