Are you using your home router? Do you have it setup to hand out addresses automatically?
The normal way to setup a WiFi network on the iPhone is to go to Settings, WiFi and then choose a network (ensuring that WiFi is set to "On" of course).
Your connected network should show a small checkmark beside the name, indicating that you're connected. The blue arrow to the right will let you view the actual network properties, such as your IP address and so forth. If you're connected to the network but still not getting anything, you may want to click the blue arrow button and confirm that the iPhone has an IP address, DNS server, and router address filled in on that screen. If any of these are missing or incorrect, you will not be able to access the Internet.