There is no way to recover the passcode to an iPhone.
You will have to restore the device to factory settings. This means that ALL data on the device will be removed and it will be set to it's original settings, like it's just out of the box.
Click here for instructions on restoring your device: http://support.apple.com/kb/ht1414
If you have backed up your iPhone, you may be able to recover those settings and put them back on the device.
*You will need an authorized computer with iTunes installe din order to restore your iPhone.