Fancyhdr, even and odd

I want to add the chapter name to the header of even pages and section name to odd. But the output show me just the name of section in every page (odd or even). In below, you can find the sample of the code, could you please help me to fix this issue?

  %%% Fancy Header %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Fancy Header Style Options
\usepackage{fancyhdr}                    % Fancy Header and Footer

\pagestyle{fancy}                       % Sets fancy header and footer
\fancyfoot{}                            % Delete current footer settings

\fancyhf{}

\fancyhead[LE,RO]{\bfseries\thepage}    % Page number (boldface) in left on even
% pages and right on odd pages
\renewcommand{\chaptermark}[1]{\markboth{\MakeUppercase{\thechapter.\ #1}}{}}

\fancyhead[RE]{\bfseries\nouppercase{\leftmark}}      % Chapter in the right on even pages
\fancyhead[LO]{\bfseries\nouppercase{\rightmark}}     % Section in the left on odd pages

\usepackage{colortbl}
\arrayrulecolor{black}

\fancypagestyle{plain}{
\fancyhf{}
\fancyfoot{}
}

• I was forget to change onsde to twoside. – hayder May 28 '14 at 13:48

Just make sure to use the twoside option in your documentclass. E.g.:

\documentclass[twoside]{report}

\usepackage{lmodern}
\usepackage{fancyhdr}

\pagestyle{fancy}                       % Sets fancy header and footer
\fancyfoot{}                            % Delete current footer settings

\fancyhf{}

\fancyhead[LE,RO]{\bfseries\thepage}    % Page number (boldface) in left on even
% pages and right on odd pages
\renewcommand{\chaptermark}[1]{\markboth{\MakeUppercase{\thechapter.\ #1}}{}}

\fancyhead[RE]{\bfseries\nouppercase{\leftmark}}      % Chapter in the right on even pages
\fancyhead[LO]{\bfseries\nouppercase{\rightmark}\chaptermark}     % Section in the left on odd pages

\usepackage{colortbl}
\arrayrulecolor{black}

\fancypagestyle{plain}{
\fancyhf{}
\fancyfoot{}
}

\begin{document}

\chapter{Chapter Name}

\newpage
Hello, zero page.

\section{Section Name}
Hello, first page.

\newpage

Hello, second page.
\end{document}


And this is the result: