If you've assigned a passcode to your Apple iPhone so that other people can't access your device without typing in this unique code, you don't actually need to know the code if you want to create a backup of the content on your device. All you need to do is use Apple's iTunes, which is the program that you've been using to transfer content from your computer to your device all along.
Connect your iPhone to your computer. Use the USB syncing cable that you have been using to connect your iPhone to your computer all along.
Open iTunes by double-clicking on its shortcut icon on your desktop. If no desktop icon exists, one is present in the "iTunes" folder of your "Start" menu.
Right-click on your iPhone's name in the "Devices" listing in iTunes.
Click "Backup" to create a backup of your iPhone without using the passcode that you have set on the device itself.