My iPhone is stuck on the apple logo (the loading screen)

It won't turn off and if it does it automatically turns itself off within 5 seconds. I don't know what to do. I've tried following several steps from various websites and i'm at a loss.anybody have any extra tips?

Press power button and home button together until it switches off imminently release both buttons. This may take 5 -10 seconds for it to switch off. If not you will have to go into recovery mode and restore your device on itunes

iPhone Recovery mode:
Disconnect your iPhone and turn it off by holding the "Sleep/Wake" button for about five seconds and then sliding the red slider. If your iPhone is already off, there's no need to turn it on and then off again. Once it's off, press and hold the "Home" button and plug your iPhone into a Mac or PC with iTunes installed. Keep holding the "Home" button until you see a dock cable pointing to the iTunes icon.iPhones running older software will display a yellow triangle and text which says "Please Connect to iTunes". Once you see this image, you can release the Home button. Open iTunes (if it's not already open) and you will be told that "iTunes has detected an iPhone in recovery mode." Click "OK" and you will be taken to the iPhone pane. Click "Restore" and you're done, it's that easy! Depending on the extent of your iPhone's ills, it may take some time to do a full restore. Once you're done, you should again have a perfectly working iPhone.

If this doesn't solve your problem, you may need to restore using DFU (Direct Firmware Upgrade) mode. To enter this mode, plug in your iPhone and turn it off. Hold down the "Home" and "Sleep/Wake" buttons for about twelve seconds. You'll briefly see the silver Apple logo and then your phone will appear to turn back off. Release the "Sleep/Wake" button but continue to hold the "Home" button until you see a message in iTunes stating that it has detected an iPhone in recovery mode. Choose "Restore" and you should be fixed right up!