Yes, you need all the files in the root folder. That is whichever extensions you are using. The example I have given you will not be correct for your application.
To make your example work in localhost you need to download and put onto your computer Wamp server. Just search for this on Google and it is self installing and pretty straight forward to install. If you have any problems, just get back to me on here!
Hope this helps.