In this paper, we develop an online basis enrichment method with the mortar mixed finite element method, using the oversampling technique, to solve for flow problems in highly heterogeneous media. We first compute a coarse grid solution with a certain number of offline basis functions per edge, which are chosen as standard polynomials basis functions. We then iteratively enrich the multiscale solution space with online multiscale basis functions computed by using residuals. The iterative solution converges to the fine scale solution rapidly. We also propose an oversampling online method to achieve faster convergence speed. The oversampling refers to using larger local regions in computing the online multiscale basis functions. We present extensive numerical experiments(including both 2D and 3D) to demonstrate the performance of our methods for both steady state flow, and two-phase flow and transport problems. In particular, for the time dependent two-phase flow and transport problems, we apply the online method to the initial model, without updating basis along the time evolution. Our numerical results demonstrate that by using a few number of online basis functions, one can achieve a fast convergence.