I did a numeric paging system for my results page.

And this is my code:

Code:
<%
pages = INT(total / rppage)
IF (total Mod rppage) <> "0" Then pages = pages + 1
For p = 1 To pages
IF cpage = p Then
%>
&nbsp;<%=p%>&nbsp;
<%Else%>
&nbsp;<a href="?q=<%=search%>&cpage=<%=p%>"><%=p%></a>&nbsp;
<%
End IF
NEXT
%>
pages: is the number of pages we need.
total: total records
rppage: is set to 10 which is the maximum number of results to show on each page.
cpage: is current page

I'm supposed to show them as:

1 2 3 4 5 etc..

And IF I click on 2 for example the link should be removed from it

1 2 3 4 5

But my code is not working I don't know why, I wrote if cpage = p Then ... but it's keeping the link on it.

Thanks very much,
zeid