# Tables and sections get misplaced

These are my tables:

 \section{The status of respondents}
\begin{center}
\begin{table}
\begin{tabular}{|l|l|l|l|}
\hline
\textbf{Sl.No.} & \textbf{Grouping of Respondents} & \textbf{Respondents} & \textbf{Percentage} \\
\hline
1 & Students & 38 & 76\% \\
\hline
2 & Employees & 12 & 24\% \\
\hline
& \textbf{Total} & 50 & 100\% \\
\hline
\end{tabular}
\caption{The status of respondents}
\end{table}
\end{center}

Among the 50 respondents 38 were students and 12 were employees.
\section{Some section}
\begin{center}
\begin{table}
\begin{tabular}{|l|l|l|l|}
\hline
\textbf{Sl.No.} & \textbf{Options} & \textbf{Respondents} & \textbf{Percentage} \\
\hline
1 & Getting it without making payment & 29 & 58\% \\
\hline
2 & Free to use it for any purpose & 10 & 20\% \\
\hline
3 & Free to distribute copies & 11 & 22\% \\
\hline
& \textbf{Total} & 50 & 100\% \\
\hline
\end{tabular}
\end{table}
\end{center}


When I compile into a pdf the tables appear together, and section names and other writing in the middle will appear separately after the tables.

-
possible duplicate of How can I inhibit LaTeX to float a table across a section boundary? – TH. Apr 11 '11 at 7:12
Maybe tex.stackexchange.com/questions/9485/how-to-fix-table-position was a better match for a duplicate. There are many to choose from. – TH. Apr 11 '11 at 7:16

do not put the tables inside a center environment.

\listfiles
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}

\begin{document}

\section{The status of respondents}
\begin{table}[!htb]
\centering
\begin{tabular}{|l|l|l|l|}\hline
\textbf{Sl.No.} & \textbf{Grouping of Respondents} & \textbf{Respondents} & \textbf{Percentage} \\
\hline
1 & Students & 38 & 76\% \\
\hline
2 & Employees & 12 & 24\% \\
\hline
& \textbf{Total} & 50 & 100\% \\
\hline
\end{tabular}
\caption{The status of respondents}
\end{table}

Among the 50 respondents 38 were students and 12 were employees.
\section{Some section}
\begin{table}[!htb]
\centering
\begin{tabular}{|l|l|l|l|}\hline
\textbf{Sl.No.} & \textbf{Options} & \textbf{Respondents} & \textbf{Percentage} \\
\hline
1 & Getting it without making payment & 29 & 58\% \\
\hline
2 & Free to use it for any purpose & 10 & 20\% \\
\hline
3 & Free to distribute copies & 11 & 22\% \\
\hline
& \textbf{Total} & 50 & 100\% \\
\hline
\end{tabular}

if you do not want that your tables should placed by TeX, then don't use a table environment, use \captionof{table}{...} instead (needs package caption) – Herbert Apr 12 '11 at 12:35