"So why do we need libraries when everything in online???"
Many reasons. Certainly, the role of libraries has developed and transformed significantly over the last 150+ years (when true "public" libraries first emerged). The mission and purpose of libraries and librarians is vastly different today than it was in the mid-1800s. That doesn't mean that they are going away. By all accounts, it seems that people are needing and using libraries and librarians as much as, if not more than, ever.