Below is the code I have currently and the output which it brings, but I was wondering if there was a way to get the section title to show in the same way without having to type it in /rhead for every section?
\documentclass[a4paper, 12pt, fleqn]{article}
\usepackage{fancyhdr}
\titleformat{\section}[display]{\centering\Large\bfseries}{}{0pt}{\underline} \sectionfont{\centering}
\pagestyle{fancy}
\fancyhf{}
\rhead{Unit 1: Algebra}
\lhead{MST124}
\rfoot{Page \thepage \hspace{1pt} of \pageref{LastPage}}
\section{Unit 1: Algebra}
\chapter
command. The code you make available lacks some packages and it does not compile at all. You should provide a minimal working example. However I will try to give you an answer.