While it is true that some uneducated people in the Middle Ages may have believed in the idea of a "flat Earth," most historians now agree that this belief was not widespread. Certainly, the idea was not accepted by Medieval scholars, who relied on the cosmological wisdom of the ancient Greeks. As early as the 6th century BCE, Pythagoras wrote that the Earth was, indeed, a sphere. Later, Aristotle and Euclid agreed.
As it turns out, the myth that Medieval people believed in a flat Earth is a more modern one, dating to the 1800s. In 1828, for example, author Washington Irving popularized the "flat Earth" myth in his highly fictionalized work, The Life and Voyages of Christopher Columbus. There, he asserted (inaccurately) that Europeans first learned that the Earth was round when Columbus sailed to the New World. The myth was repeated often enough until it became a "fact" taught in many a history class.
For more on this topic, check out this Wikipedia article. You may also be interested in this article which discusses the top 10 myths about the Middle Ages. Last but not least, for a wonderful website on all things Medieval, check out Medievalists.net, which I have also added to our collection of links on the Legendarium page.