Order your troops to:
Stand Closer F8, a tight battle-line is essential to breaking a cavalry charge.
Hold Position F1, again, this keeps the infantrymen close together, think pike squares and phalanxes.
If you're feeling skilled:
Order Crossbowmen (3 selects archers) to the front (F6 to Advance) while the enemy is far off, F5 toggles Hold Fire/Fire at Will. I usually have my ranged units hold their fire if the enemy is beyond 150-200 yards (meters). Also hold their fire if they're executing maneuvers.
Then as the enemy advances, but prior to the enemy charge, have your archers fall back (F7) into or behind your main battle line, or inversely advance your infantry into or ahead of the archers' line. (2 selects Infantry, F6 advances)
Side-Note: In "The Art of War" by Machiavelli, which is a record of the discourse between Machiavelli's fellow intellectuals, the inherent strength and value of an infantry based militia-army is stressed. The work is significant because at the time, most states employed cavalry and foreign mercenaries, rather than recruit a force of domestic foot-soldiers. Machiavelli's friend Fabrizzio recommends a force composed of roughly: one-half heavy infantry, one-third pike-men, and the remaining sixth be armed with harquebuses and crossbows.
When I raise and infantry army in Mount&Blade, I like to have roughly two-thirds consisting of Huscarls and Rhodok Seargents, and the remaining one-third Rhodok Sharpshooters (with the occasional Vaegir Marksman in the mix).
Keeps your battle lines tight and orderly.