Texturing all faces

Suppose I make a cube whenever I texture it only the top is textured and all the other sides look messed up. How do I textures all of the faces?

UV mapping is the answer!

I hope this link will be of help --> http://wiki.blender.org/index.php/Doc:Manual/Textures/UV/Unwrapping_a_Mesh

You have to change from flat to cube in the map input tab