Cannot Erase my old iPhone
Method 1:
Try resetting it via iTunes. To do this: Plug your iPhone into your computer and open iTunes. In iTunes, select your iPhone device and click on "Restore iPhone". Let the process finish and the phone restart. After the restart you can plug it out of your computer. Now should your iPhone be reseted to factory defaults.

Method 2:
You say that you can't connect it to your Wi-Fi network. Have you tried with forgetting the network? To forget the network: Go into the Settings application -> Wi-Fi -> Tap on the little "i" at the same row as the name (SSID) of your Wi-Fi network.
Now you can try to reconnect to the Wi-Fi network again and see if it works better. If you are able to connect to the Wi-Fi network, then you can reset it via the Settings application.