[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Sort Column Problem

Posted on 2004-11-17
11
Medium Priority
?
421 Views
Last Modified: 2008-02-01
I have a page at http://charlestonhomehunters.com/Search_main_Results_Sort.asp

I have a SORT COLUMN script in the code just above the SELECT statement. My problem is, if I do a narrow search criteria, for instance 4+ bedrooms and the search returns all homes with 4 or more bedrooms and then click on an ARROW TO SORT ONE OF THE COLUMNS, I then get the entire database of info.

Is there a way I can keep the search criteria where it only sorts the current criteria when I click on one of the COLUMNS????

Thanks.


<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!-- HEADER -->
<HTML><HEAD><TITLE>CharlestonHomeHunters.com | Search our real estate listings for homes, land, developments or commercial properties.</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<META
content="CharlestonHomeHunters.com provides 360 degree interactive virtual home tours for real estate agents and home builders."
name=description>
<META
content="CharlestonHomeHunters.com 360 Charleston Home Hunters, real estate, realtors, virtual tours, panoramas, bamboo, bamboo.com, ipix, apple quicktime, Salt Lake City, Utah, SLC, brokers, homes, home, houses, house, 360 degrees, 360 degree view, virtual homes online, homeseekers.com loopnet, jutvision, construction companies, art gallery, art galleries, mortgages, sell, buy, selling, buying, land, realtor.com, CharlestonHomeHunters.com 360 Charleston Home Hunters, real estate, realtors, virtual tours, panoramas, bamboo, bamboo.com, ipix, apple quicktime, Salt Lake City, Utah, SLC, brokers, homes, home, houses, house, 360 degrees, 360 degree view, virtual homes online, homeseekers.com loopnet, jutvision, construction companies, art gallery, art galleries, mortgages, sell, buy, selling, buying, land, realtor.com,"
name=keywords>
<META content="Andy Evans - andy@CharlestonHomeHunters.com - http://www.CharlestonHomeHunters.com
name=author><LINK href="/CHHfiles/charlestonhomehunters/Search_files/stylesheet.css" type=text/css
rel=StyleSheet>
<LINK REL="StyleSheet" TYPE="text/css" HREF="/stylesheet.css">
<body bgcolor="white" link="0000a0" vlink="gray">
<DIV align=center>
  <TABLE border=0 cellpadding=0 cellspacing=0 width=100%>
    <TR valign=top bgcolor="white">
      <TD colspan="2">
            <form action="search_main_results_sort.asp" method="post"><table cellspacing="2" border="0" cellpadding="2" valign="top">
          <tr>
            <td class="WhiteMedHeader" bgcolor="1E1E1E"><img src="/CHHfiles/charlestonhomehunters/search_files/blank.gif" height="5" border="0">Search
              Criteria: <span class="Body" style="color:silver">(418 Results)</span></td>
            <td width="57" align="right">&nbsp;</td>
          </tr>
          <tr valign="top">
            <td bgcolor="F0F0F0" nowrap class="small" colspan="2"> &nbsp;&nbsp;<B>CHARLESTON
              AREA: </B>
              <SELECT name=MLS>
                          <OPTION value="" selected>Select Area...
                          <OPTION value=11>West Ashley IMC
                          <OPTION value=12>West Ashley OMC
                          <OPTION value=13>West Ashley Rural
                          <OPTION value=21>James Island P.S.D.
                          <OPTION value=22>Folly Beach
                          <OPTION value=23>Johns Island
                          <OPTION value=24>Wadmalaw Island
                          <OPTION value=25>Kiawah
                          <OPTION value=25>Seabrook
                          <OPTION value=26>Edisto Island
                          <OPTION value=27>Edisto Beach
                          <OPTION value=31>N. Charleston IMC
                          <OPTION value=32>N. Charleston OMC
                          <OPTION value=41>E. of the Cooper Past 41
                          <OPTION value=42>E. of the Cooper To 41
                          <OPTION value=43>Sullivan's Island
                              <OPTION value=44>Isle Of Palms
                              <OPTION value=45>Wild Dunes
                              <OPTION value=46>Dewees Island
                              <OPTION value=47>Awendaw/McClellanville
                              <OPTION value=51>Peninsula Below Crosstown
                              <OPTION value=52>Peninsula Above Crosstown
                              <OPTION value=61>Dorch. Rd Below Ladson Rd
                              <OPTION value=62>Dorch. Cnty-Ladson Bacons Brdg
                              <OPTION value=63>Bacons Brdg/Four Hole Swamp
                              <OPTION value=64>Dorch. Cnty Above Four Hole
                              <OPTION value=71>Hanahan
                              <OPTION value=72>S.E. Goose Creek
                              <OPTION value=73>N.W. Goose Creek
                              <OPTION value=74>Berkeley Triangle 17AC
                              <OPTION value=75>Rural Berkeley County
                              <OPTION value=76>Moncks Corner & Pinopolis
                              <OPTION value=77>Daniel Island
                              <OPTION value=81>Out Of Tri-County Area
                              <OPTION value=82>Colleton County
                              <OPTION value=83>Orangeburg County
                              </OPTION></SELECT>
              &nbsp;<B>TYPE: </B>
              <SELECT name=LIST_TYPE>
                        <OPTION value="" selected>None
                              <OPTION value=SFR>Single Family Residential
                              <OPTION value=TOWN>Townhouse
                              <OPTION value=COVI>Condo/Villa
                              <OPTION value=DUPL>Duplex
                              <OPTION value=TRIP>Triplex
                              <OPTION value=QUAD>Quadriplex
                              <OPTION value=VAC>Vacation Property
                              <OPTION value=MOBI>Mobile Home
                              <OPTION value=LOT>Lots
                              <OPTION value=MULT>Multi Unit
                              <OPTION value=COMM>Commercial/Investment
                              </OPTION></SELECT>
              &nbsp; </td>
          </tr>
          <tr>
            <td bgcolor="F0F0F0" nowrap class="small" colspan="2"> &nbsp;&nbsp;<B>BEDROOMS:
              </B>
              <SELECT name=BR>
                        <OPTION value="" selected>None
                          <OPTION value=1>1+
                              <OPTION value=2>2+
                              <OPTION value=3>3+
                              <OPTION value=4>4+
                              <OPTION value=5>5+
                              <OPTION value=6>6+
                              <OPTION value=7>7+
                              <OPTION value=8>8+
                              <OPTION value=9>9+
                          </OPTION></SELECT>
              <B>&nbsp;&nbsp;&nbsp;&nbsp;BATHS: </B>
              <SELECT name=BA>
                           <OPTION value="" selected>None
                           <OPTION value=1>1+
                              <OPTION value=2>2+
                              <OPTION value=3>3+
                              <OPTION value=4>4+
                              <OPTION value=5>5+
                              <OPTION value=6>6+
                              <OPTION value=7>7+
                              <OPTION value=8>8+
                              <OPTION value=9>9+
                          </OPTION></SELECT>
              &nbsp;&nbsp; <B>SQUARE FEET: </B> <select name=SQFT>
                <option value="" selected>None
                <option value=500>&nbsp;&nbsp;500+
                <option value=1000>1000+
                <option value=1500>1500+
                <option value=2000>2000+
                <option value=3000>3000+
                <option value=4000>4000+
                <option value=5000>5000+
                <option value=7500>7500+
                <option value=10000>10,000+ </option>
              </select></TD>
          </tr>
              <tr>
                <td bgcolor="F0F0F0" nowrap class="small" colspan="2"> <B>&nbsp;&nbsp;MINIMUM
              PRICE: </B>
              <SELECT name=LPRICE>
                        <OPTION value="" selected>None
                              <OPTION value=50000>&nbsp;&nbsp;50K or more
                              <OPTION value=100000>100K or more
                              <OPTION value=150000>150K or more
                              <OPTION value=200000>200K or more
                              <OPTION value=250000>250K or more
                              <OPTION value=300000>300K or more
                              <OPTION value=350000>350K or more
                              <OPTION value=400000>400K or more
                              <OPTION value=450000>450K or more
                              <OPTION value=500000>500K or more
                              <OPTION value=600000>600K or more
                              <OPTION value=700000>700K or more
                              <OPTION value=800000>800K or more
                              <OPTION value=900000>900K or more
                              <OPTION value=1000000>1 Mil or more
                              <OPTION value=1250000>1.25 Mil or more
                              <OPTION value=1500000>1.50 Mil or more
                              <OPTION value=1750000>1.75 Mil or more
                              <OPTION value=2000000>2 Mil or more
                              <OPTION value=2500000>2.5 Mil or more
                              <OPTION value=3000000>3 Mil or more
                              <OPTION value=3500000>3.5 Mil or more
                              <OPTION value=40000000>4 Mil or more
                              <OPTION value=45000000>4.5 Mil or more
                              <OPTION value=50000000>5 Mil or more
                              </OPTION></SELECT>
              <B>&nbsp;&nbsp;&nbsp;MAXIMUM PRICE: </B>
              <SELECT name=HPRICE>
                        <OPTION value="" selected>None
                              <OPTION value=50000>&nbsp;&nbsp;50K or less
                              <OPTION value=100000>100K or less
                              <OPTION value=150000>150K or less
                              <OPTION value=200000>200K or less
                              <OPTION value=250000>250K or less
                              <OPTION value=300000>300K or less
                              <OPTION value=350000>350K or less
                              <OPTION value=400000>400K or less
                              <OPTION value=450000>450K or less
                              <OPTION value=500000>500K or less
                              <OPTION value=600000>600K or less
                              <OPTION value=700000>700K or less
                              <OPTION value=800000>800K or less
                              <OPTION value=900000>900K or less
                              <OPTION value=1000000>1 Mil or less
                              <OPTION value=1250000>1.25 Mil or less
                              <OPTION value=1500000>1.50 Mil or less
                              <OPTION value=1750000>1.75 Mil or less
                              <OPTION value=2000000>2 Mil or less
                              <OPTION value=2500000>2.5 Mil or less
                              <OPTION value=3000000>3 Mil or less
                              <OPTION value=3500000>3.5 Mil or less
                              <OPTION value=40000000>4 Mil or less
                              <OPTION value=45000000>4.5 Mil or less
                              <OPTION value=50000000>5 Mil or less
                              </OPTION></SELECT>
              </td>
              </tr>
          <tr valign="center">
            <td bgcolor="f0f0f0" nowrap class="small" colspan="2"> &nbsp;&nbsp;<b>STREET
              NAME: </b>
              <input type="Text" name="ST_NAME" size="20" value="">
              &nbsp;&nbsp;PROPERTY ID: </b>
              <input type="Text" name="CHHID" size="14" value="">
              </TD></TR>
                    <TR>
            <td bgcolor="F0F0F0" nowrap class="small" colspan="2">&nbsp;&nbsp;
              <input name="submit" type="submit" value="Search"> &nbsp;&nbsp;&nbsp;[<a href="search_main_results_sort.asp">CLEAR
              SEARCH</a>] </td>
          </tr>
        </form>
        <tr>
          <td align="right" background="/CHHfiles/charlestonhomehunters/images/tab_bottom2.gif" colspan="2"><img
      src="/CHHfiles/charlestonhomehunters/search_files/tab_bottom.gif" border="0" align="top" width="100" height="8"></td>
        </tr>
  </table>
</div>
<div align="center">
<br>
  <table border="0" cellpadding="2" cellspacing="2" width="100%">
    <tr>
      <td background="/CHHfiles/charlestonhomehunters/images/tab_top2.gif" class="WhiteMedHeader" colspan="2" bgcolor="000000">Property
        Results:</td>
      <td width="9%" bgcolor="white">&nbsp;</td>
      <td width="9%" bgcolor="white">&nbsp;</td>
      <td width="10%" bgcolor="white"><img src="/CHHfiles/charlestonhomehunters/Search_files/icon_back2.gif" width="49" height="22" align="right"></td>
      <td width="22%" align="center" nowrap bgcolor="ffffff" class="small"><b>Showing
        1-10 of 418</b> </td>
      <form action="/CHHfiles/charlestonhomehunters/search_main_results_sort.asp" method="post">
        <td width="14%" align=left bgcolor="ffffff" class="small"><input type="Hidden" name="page" value="2">
          <img src="/CHHfiles/charlestonhomehunters/Search_files/icon_next.gif" width="47" height="22">
        </td>
      </form>
    </tr>
    <tr valign="middle" bgcolor="Silver" class="small">
      <td width="12%" nowrap class="small">
        <div align="center"><b>PHOTO</b></div></td>
      <td width="24%" nowrap class="small"><div align="center"><b>AREA</b></div></td>
      <td nowrap class="small">
        <div align="center"><b><a href="Search_main_Results_Sort.asp?Sort=BR_a"><img src="/Images/Down.jpg" align="middle"></a>&nbsp;BR&nbsp;<a href="Search_main_Results_Sort.asp?Sort=BR_d"><img src="/Images/Up.jpg" align="middle"></a></b></div></td>
      <td nowrap class="small">
        <div align="center"><b><a href="Search_main_Results_Sort.asp?Sort=BA_a"><img src="/Images/Down.jpg" align="middle"></a>&nbsp;BA&nbsp;<a href="Search_main_Results_Sort.asp?Sort=BA_d"><img src="/Images/Up.jpg" align="middle"></a></b></div></td>
      <td nowrap class="small">
        <div align="center"><b><a href="Search_main_Results_Sort.asp?Sort=SQFT_a"><img src="/Images/Down.jpg" align="middle"></a>&nbsp;SQFT&nbsp;<a href="Search_main_Results_Sort.asp?Sort=SQFT_d"><img src="/Images/Up.jpg" align="middle"></a></b></div></td>
      <td nowrap class="small">
        <div align="center"><b>CONTACT</b></div></td>
      <td nowrap class="small">
        <div align="center"><b><a href="Search_main_Results_Sort.asp?Sort=PRICE_a"><img src="/Images/Down.jpg" align="middle"></a>&nbsp;PRICE&nbsp;<a href="Search_main_Results_Sort.asp?Sort=PRICE_d"><img src="/Images/Up.jpg" align="middle"></a></b></div></td>
    </tr>
    <%
set objRec = server.CreateObject("ADODB.Recordset")
objRec.ActiveConnection = "dsn=homehunt_db;uid=hardware;pwd=listings;network=dbmssocn"

'declare the variables
dim objCon
dim objRec
dim strSQL
dim strSort 'this variable is INCASE you sort
DIM strSortBy, tmpSortBy
strSortBy = Request.QueryString("Sort")
Select Case strSortBy
Case "BR_a"
tmpSortBy = "ORDER BY BR ASC"
Case "BR_d"
tmpSortBy = "ORDER BY BR DESC"
Case "BA_a"
tmpSortBy = "ORDER BY BA ASC"
Case "BA_d"
tmpSortBy = "ORDER BY BA DESC"
Case "SQFT_a"
tmpSortBy = "ORDER BY SQFT ASC"
Case "SQFT_d"
tmpSortBy = "ORDER BY SQFT DESC"
Case "PRICE_a"
tmpSortBy = "ORDER BY PRICE ASC"
Case "PRICE_d"
tmpSortBy = "ORDER BY PRICE DESC"
Case Else
tmpSortBy = "ORDER BY PRICE DESC"
End Select

strSQL  = "SELECT CHHID, " & _
                  "PQUEST, " & _
                  "EXTN, " & _
                  "SRCE, " & _
                  "sLOCATION, " & _
                  "CONTACT01, " & _
                  "TITLE01, " & _
                  "PHONE01, " & _
                  "CONTACT02, " & _
                  "TITLE02, " & _
                  "PHONE02, " & _
                  "CONTACT03, " & _
                  "TITLE03, " & _
                  "PHONE03, " & _
                  "PROP_TYPE, " & _
                  "PRICE, " & _
                  "SUBDIVISION, " & _
                  "ST_NU, " & _
                  "ST_NAME, " & _
                  "ST_TYPE, " & _
                  "CITY, " & _
                  "sSTATE, " & _
                  "ZIP, " & _
                  "ZONE_TYPE, " & _
                  "SQFT, " & _
                  "BR, " & _
                  "BA, " & _
                  "TAXES, " & _
                  "LIST_TYPE, " & _
                  "YRBLT, " & _
                  "FR, " & _
                  "LR, " & _
                  "FP, " & _
                  "FLOOR, " & _
                  "LNDRY, " & _
                  "AIR, " & _
                  "HEAT, " & _
                  "RNGE, " & _
                  "OVN, " & _
                  "DW, " & _
                  "DSPSL, " & _
                  "TRSH, " & _
                  "MCRWV, " & _
                  "RFRG, " & _
                  "INT_FTRS, " & _
                  "OTHR_APP, " & _
                  "LT_ACRS, " & _
                  "LT_DSCRP, " & _
                  "LT_DMNS, " & _
                  "FNCE, " & _
                  "GAR, " & _
                  "SPRNK, " & _
                  "RDACC, " & _
                  "EXTR, " & _
                  "ROOF, " & _
                  "WTR_SWG, " & _
                  "PIC_TTL_01, " & _
                  "TN_PIC_01, " & _
                  "PIC_01, " & _
                  "PIC_TTL_02, " & _
                  "TN_PIC_02, " & _
                  "PIC_02, " & _
                  "PIC_TTL_03, " & _
                  "TN_PIC_03, " & _
                  "PIC_03, " & _
                  "PIC_TTL_04, " & _
                  "TN_PIC_04, " & _
                  "PIC_04, " & _
                  "PIC_TTL_05, " & _
                  "TN_PIC_05, " & _
                  "PIC_05, " & _
                  "PIC_TTL_06, " & _
                  "TN_PIC_06, " & _
                  "PIC_06, " & _
                  "PIC_TTL_07, " & _
                  "TN_PIC_07, " & _
                  "PIC_07, " & _
                  "PIC_TTL_08, " & _
                  "TN_PIC_08, " & _
                  "PIC_08, " & _
                  "PIC_TTL_09, " & _
                  "TN_PIC_09, " & _
                  "PIC_09, " & _
                  "PIC_TTL_10, " & _
                  "TN_PIC_10, " & _
                  "PIC_10, " & _
                  "PIC_TTL_11, " & _
                  "TN_PIC_11, " & _
                  "PIC_11, " & _
                  "PIC_TTL_12, " & _
                  "TN_PIC_12, " & _
                  "PIC_12, " & _
                  "PIC_TTL_13, " & _
                  "TN_PIC_13, " & _
                  "PIC_13, " & _
                  "PIC_TTL_14, " & _
                  "TN_PIC_14, " & _
                  "PIC_14, " & _
                  "CMT01, " & _
                  "CMT02, " & _
                  "CMT03, " & _
                  "CMT04, " & _
                  "CMT05, " & _
                  "CMT06, " & _
                  "CMT07, " & _
                  "CMT08 " & _
                  "FROM Properties "
strSQL = strSQL & "WHERE 1 = 1 "
If Len(Request("MLS")) > 0 Then strSQL = strSQL & "AND (MLS = '" & Request("MLS") & "' ) "
If Len(Request("CHHID")) > 0 Then strSQL = strSQL & "AND (CHHID = '" & Request("CHHID") & "' ) "
If Len(Request("ST_NAME")) > 0 Then strSQL = strSQL & "AND (ST_NAME = '" & Request("ST_NAME") & "' ) "
If Len(Request("LIST_TYPE")) > 0 Then strSQL = strSQL & "AND (LIST_TYPE = '" & Request("LIST_TYPE") & "' ) "
If Len(Request("BR")) > 0 Then strSQL = strSQL & "AND (BR >= '" & Request("BR") & "' ) "
If Len(Request("BA")) > 0 Then strSQL = strSQL & "AND (BA >= '" & Request("BA") & "' )  "
If Len(Request("SQFT")) > 0 Then strSQL = strSQL & "AND (SQFT >= '" & Request("SQFT") & "' ) "
If Len(Request("LPRICE")) > 0 Then strSQL = strSQL & "AND (PRICE >= '" & Request("LPRICE") & "' ) "
If Len(Request("HPRICE")) > 0 Then strSQL = strSQL & "AND (PRICE <= '" & Request("HPRICE") & "' ) " 
'if Len(Request("SortBy")) > 0 then
'   strSQL = strSQL & "ORDER BY ('" & Request("SortBy") & "') "
'   else
   strSQL = strSQL & tmpSortBy
'end if

'strSQL = strSQL & "ORDER BY ('" & Request("SortBy") & "') ; "

'open the recordset object
'objRec.Open strSQL, objCon, 3
objRec.CursorType = 0
objRec.CursorLocation = 2
objRec.LockType = 3
objRec.Open strSQL
'check if the recordset object returned any records
'if objRec.EOF then
  'if there are no records display a message and stop
  'processing the page
'  Response.Write  "No records available"
'  Response.End
'end if

While Not objRec.EOF
if x = 1 then
sBgcolor="E8E8E8"
x=2
Else
sBgcolor="F7F7F7"
x=1
End if

Response.Write "<tr class=return bgcolor="&sBgcolor&">"

%>
    <td class="small"><a href="http://www.charlestonhomehunters.com/HomeView.asp?homeviewid=<%=objRec("CHHID")%>" onClick="popup = window.open('http://charlestonhomehunters.com/HomeView.asp?homeviewid=<%=objRec("CHHID")%>', 'PopupPage', 'height=550,width=590,scrollbars=yes,resizable=yes'); return false" target="_blank">
      </a><a href="http://www.charlestonhomehunters.com/HomeView.asp?homeviewid=<%=objRec("CHHID")%>" onClick="popup = window.open('http://charlestonhomehunters.com/HomeView.asp?homeviewid=<%=objRec("CHHID")%>', 'PopupPage', 'height=550,width=590,scrollbars=yes,resizable=yes'); return false" target="_blank"><img src="/<%=objRec("PROP_TYPE")%>/<%=objRec("CHHID")%>/<%=objRec("TN_PIC_01")%>" width="85" height="64" border="0"></a>
    </td>
    <td class="small" nowrap> <b><%=objRec("sLOCATION")%></b><br> <a href="http://www.charlestonhomehunters.com/HomeView.asp?homeviewid=<%=objRec("CHHID")%>" onClick="popup = window.open('http://www.charlestonhomehunters.com/HomeView.asp?homeviewid=<%=objRec("CHHID")%>', 'PopupPage', 'height=550,width=590,scrollbars=yes,resizable=yes'); return false" target="_blank"><span class="bodylink"><%=objRec("ST_NU")%>&nbsp;<%=objRec("ST_NAME")%>&nbsp;<%=objRec("ST_TYPE")%></span></a><br> <%=objRec("CITY")%>,&nbsp;<%=objRec("sSTATE")%>&nbsp;<%=objRec("ZIP")%><br> <b><%=objRec("SUBDIVISION")%></b><br> <b>CHH#:</b>&nbsp;<%=objRec("CHHID")%></td>
      <td valign="top" nowrap class="small"> <br>
        <%=objRec("BR")%></td>
      <td valign="top" nowrap class="small"><br>
        <%=objRec("BA")%></td>
      <td valign="top" nowrap class="small"><br>
        <%=FormatNumber(objRec("SQFT"),0)%></td>
      <td valign="top" nowrap class="small"><br>
        <%=objRec("CONTACT01")%><br> <%=objRec("PHONE01")%><br> <%=objRec("CONTACT02")%><br> <%=objRec("PHONE02")%><br> </td>
      <td valign="top" nowrap class="small"><br>
        <%=FormatCurrency(objRec("PRICE"), 0)%>
<div align="center"></div></td>
    </tr>
    <%
iCount = iCount + 1
objRec.MoveNext
Wend
objRec.Close
set objRec = Nothing
%>
    <tr>
      <td align="right" background="/CHHfiles/charlestonhomehunters/images/tab_bottom2.gif" colspan="7"><img
src="/CHHfiles/charlestonhomehunters/search_files/tab_bottom.gif" border="0" align="top" width="100" height="8"></td>
    </tr>
    <tr>
      <td colspan="2" class="small" bgcolor="ffffff">&nbsp;</td>
      <td bgcolor="white">&nbsp;</td>
      <td bgcolor="white">&nbsp;</td>
      <td bgcolor="white" class="small"><img src="/CHHfiles/charlestonhomehunters/Search_files/icon_back2.gif" width="49" height="22" align="right"></td>
      <td align="center" nowrap bgcolor="ffffff" class="small"><b>Showing 1-10
        of 418</b> </td>
      <td bgcolor="white"><img src="/CHHfiles/charlestonhomehunters/Search_files/icon_next.gif" width="47" height="22"></td>
    </tr>
  </table>
</div>
<!-- FOOTER -->
<TABLE width="100%">
<TR>
<TD width=5 bgcolor="f0f0f0" class="small"><img src="/CHHfiles/charlestonhomehunters/images/blank.gif" width=5 height=1 border=0>
</TD></TR>
<TR>
  <TD colspan=4 class="smallgray"><!--#include file="Includes/footer.asp"--></TD>
</TR>
</TABLE>
</body></html>
0
Comment
Question by:javajamminman
  • 4
  • 4
  • 3
11 Comments
 
LVL 26

Expert Comment

by:Alan Warren
ID: 12602274
Hi javaman

You mean something like this?
*********** Link removed *************
the link in question was  only posted temporarily and is not relevant to the final outcome of this  question, leaving this link posed some security issues for the  poster.
***********************************
   comment edited by Alan(Page Ed Databases)
***********************************

Click the column headings to order by that column.

If this is the sort of thing you are looking for I may be able to offer  some assistance here.
Gotta do a few things right at the moment though.

You might need to move your Form variables  to session variable so the selections the user has made are persisted between page reloads.



Alan
0
 
LVL 60

Expert Comment

by:Julian Hansen
ID: 12602770
I haven't read through your source - it's a bit lengthy and time is few. However, having done this before here is what I did.

You keep a hidden field on your page that you manage through script. The way I did it was to treat my page like a state machine. In other words I kept all the information necessary for representing the correct data view in hidden fields on the page. Whenever a user clicked something it would first update these hidden fields (where necessary) before submitting the data back to the server. The server script would then use these hidden field values to construct the correct query and resulting page sent back to the user.

Does that help or do I need to be a bit more specific?
0
 

Author Comment

by:javajamminman
ID: 12602818
I've tried adding this and it still won't keep the values...if I choose CHARLESTON AREA, 3 records result, but when I go click on the sort column, then ALL the records appear??

Values won't remain on refresh.

      <form action="Search_main_Results_Sort.asp" method="post">
        <td align=left class="small" bgcolor="ffffff"><input type="Hidden" name="page" value="2">
          <input type="Hidden" name="MLS" value=""> <input type="Hidden" name="BR" value="">
          <input type="Hidden" name="SQFT" value=""> <input type="Hidden" name="LPRICE" value="">
          <input type="Hidden" name="HPRICE" value=""> <input type="Hidden" name="ST_NAME" value="">
          <input type="Hidden" name="CHHID" value=""><input type="Hidden" name="LISTING_TYPE" value="">
              <input type="Hidden" name="BA" value="">
        </td>
      </form>
0
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
LVL 26

Expert Comment

by:Alan Warren
ID: 12602860
Hi javajamminman

  did you check the link I posted, is this the sort of functionality you are looking for?

Alan
0
 

Author Comment

by:javajamminman
ID: 12602974
Yes, I have it sorting like that. My problem is, when I click on one of the search criteria and it returns just 3 rows, when I click on the SORT for the at colum ALL the rows in the database appear????

Dan
0
 
LVL 60

Expert Comment

by:Julian Hansen
ID: 12603186
>> I've tried adding this and it still won't keep the values...if I choose CHARLESTON AREA, 3 records result, but when I go click on the sort column, then ALL the records appear??


Ok - I tried looking through your code - better if you do it though.

Where in the code do you set the value of the hidden variables when you click on CHARLESTON AREA an the sort column.

Somewhere you should be picking these variables up and saving them in hidden fields for the next page.

What I did was to pick-up the onclick event for the controls / objects that modify the sort or filtering of the records. I then used script to set the value of a hidden field before calling the form submit programattically.

Somewhere you have to have code that keeps the hidden fields up to date. If you can post a pointer to where this code is we can take it from there.
0
 
LVL 26

Accepted Solution

by:
Alan Warren earned 2000 total points
ID: 12603226
Hi Dan,



something like  this maybe...

<%

If Len(Request("MLS")) > 0 Then Session("MLS")= Request("MLS")
If Len(Request("CHHID")) > 0 Then Session("MLS")= Request("CHHID")
If Len(Request("ST_NAME")) > 0 Then Session("MLS")= Request("LIST_TYPE")
If Len(Request("LIST_TYPE")) > 0 Then Session("MLS")= Request("BR")
If Len(Request("BR")) > 0 Then strSQL = Session("MLS")= Request("BR")
If Len(Request("BA")) > 0 Then strSQL = Session("MLS")= Request("BA")
If Len(Request("SQFT")) > 0 Then strSQL = Session("MLS")= Request("SQFT")
If Len(Request("LPRICE")) > 0 Then strSQL = Session("MLS")= Request("LPRICE")
If Len(Request("HPRICE")) > 0 Then strSQL = Session("MLS")= Request("HPRICE")
%>

' then set your option value selected to the session var
' something like this

<SELECT name=MLS>
  <OPTION value="" selected>Select Area...
  <option value="" <%if session("MLS")="" then%>SELECTED<%end if%>>""</option>
  <option value="West Ashley IMC" <%if session("MLS")="West Ashley IMC" then%>SELECTED<%end if%>>""</option>
  ' etc...


<%
If Len(Session("MLS")) > 0 Then strSQL = strSQL & "AND (MLS = '" & Session("MLS") & "' ) "
If Len(Session("CHHID")) > 0 Then strSQL = strSQL & "AND (CHHID = '" & Session("CHHID") & "' ) "
If Len(Session("ST_NAME")) > 0 Then strSQL = strSQL & "AND (ST_NAME = '" & Session("ST_NAME") & "' ) "
If Len(Session("LIST_TYPE")) > 0 Then strSQL = strSQL & "AND (LIST_TYPE = '" & Session("LIST_TYPE") & "' ) "
If Len(Session("BR")) > 0 Then strSQL = strSQL & "AND (BR >= '" & Session("BR") & "' ) "
If Len(Session("BA")) > 0 Then strSQL = strSQL & "AND (BA >= '" & Session("BA") & "' )  "
If Len(Session("SQFT")) > 0 Then strSQL = strSQL & "AND (SQFT >= '" & Session("SQFT") & "' ) "
If Len(Session("LPRICE")) > 0 Then strSQL = strSQL & "AND (PRICE >= '" & Session("LPRICE") & "' ) "
If Len(Session("HPRICE")) > 0 Then strSQL = strSQL & "AND (PRICE <= '" & Session("HPRICE") & "' ) " 




Alan
0
 

Author Comment

by:javajamminman
ID: 12603264
Alan, I'm making a second copy of the file and trying it...

JulianH, below is the code that I've added the HIDDEN FIELDS, still won't work for me, I may be screwing up my creation??


<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!-- HEADER -->
<HTML><HEAD><TITLE>CharlestonHomeHunters.com | Search our real estate listings for homes, land, developments or commercial properties.</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<META
content="CharlestonHomeHunters.com provides 360 degree interactive virtual home tours for real estate agents and home builders."
name=description>
<META
content="CharlestonHomeHunters.com 360 Charleston Home Hunters, real estate, realtors, virtual tours, panoramas, bamboo, bamboo.com, ipix, apple quicktime, Salt Lake City, Utah, SLC, brokers, homes, home, houses, house, 360 degrees, 360 degree view, virtual homes online, homeseekers.com loopnet, jutvision, construction companies, art gallery, art galleries, mortgages, sell, buy, selling, buying, land, realtor.com, CharlestonHomeHunters.com 360 Charleston Home Hunters, real estate, realtors, virtual tours, panoramas, bamboo, bamboo.com, ipix, apple quicktime, Salt Lake City, Utah, SLC, brokers, homes, home, houses, house, 360 degrees, 360 degree view, virtual homes online, homeseekers.com loopnet, jutvision, construction companies, art gallery, art galleries, mortgages, sell, buy, selling, buying, land, realtor.com,"
name=keywords>
<META content="Andy Evans - andy@CharlestonHomeHunters.com - http://www.CharlestonHomeHunters.com
name=author><LINK href="/CHHfiles/charlestonhomehunters/Search_files/stylesheet.css" type=text/css
rel=StyleSheet>
<META Name="description" Content="360house.com provides 360 degree interactive virtual home tours for real estate agents and home builders.">
<META Name="keywords" Content="360house.com 360 House, real estate, realtors, virtual tours, panoramas, bamboo, bamboo.com, ipix, apple quicktime, Salt Lake City, Utah, SLC, brokers, homes, home, houses, house, 360 degrees, 360 degree view, virtual homes online, homeseekers.com loopnet, jutvision, construction companies, art gallery, art galleries, mortgages, sell, buy, selling, buying, land, realtor.com, 360house.com 360 House, real estate, realtors, virtual tours, panoramas, bamboo, bamboo.com, ipix, apple quicktime, Salt Lake City, Utah, SLC, brokers, homes, home, houses, house, 360 degrees, 360 degree view, virtual homes online, homeseekers.com loopnet, jutvision, construction companies, art gallery, art galleries, mortgages, sell, buy, selling, buying, land, realtor.com,">
<META Name="author" Content="Andy Evans - andy@360House.com - http://www.360House.com">      
<LINK REL="StyleSheet" TYPE="text/css" HREF="/stylesheet.css">
<body bgcolor="white" link="0000a0" vlink="gray">
<DIV align=center>
  <TABLE border=0 cellpadding=0 cellspacing=0 width=100%>
    <TR valign=top bgcolor="white">
      <TD colspan="2">

<%
'Colect the info from first form
Dim sMLS, sLIST_TYPE, sBA, sBR, sSQFT, sLPRICE, sHPRICE, sST_NAME, sCHHID
sMLS = request.Form("MLS")
sLIST_TYPE = request.Form("LIST_TYPE")
sBA = request.Form("BA")
sBR = request.Form("BR")
sSQFT = request.Form("SQFT")
sLPRICE = request.Form("LPRICE")
sHPRICE = request.Form("HPRICE")
sST_NAME = request.Form("ST_NAME")
sCHHID = request.Form("CHHID")
%>

            <form name="frmUser" action="search_main_results_sort.asp" method="post"><table cellspacing="2" border="0" cellpadding="2" valign="top">
          <tr>
            <td class="WhiteMedHeader" bgcolor="1E1E1E"><img src="/CHHfiles/charlestonhomehunters/search_files/blank.gif" height="5" border="0">Search
              Criteria: <span class="Body" style="color:silver">(418 Results)</span></td>
            <td width="57" align="right">&nbsp;</td>
          </tr>
          <tr valign="top">
            <td bgcolor="F0F0F0" nowrap class="small" colspan="2"> &nbsp;&nbsp;<B>CHARLESTON
              AREA: </B>

              <SELECT name=MLS>
                          <OPTION value="<%=request.form("sMLS")%>" selected>Select...
                          <OPTION value=11>West Ashley IMC
                          <OPTION value=12>West Ashley OMC
                          <OPTION value=13>West Ashley Rural
                          <OPTION value=21>James Island P.S.D.
                          <OPTION value=22>Folly Beach
                          <OPTION value=23>Johns Island
                          <OPTION value=24>Wadmalaw Island
                          <OPTION value=25>Kiawah
                          <OPTION value=25>Seabrook
                          <OPTION value=26>Edisto Island
                          <OPTION value=27>Edisto Beach
                          <OPTION value=31>N. Charleston IMC
                          <OPTION value=32>N. Charleston OMC
                          <OPTION value=41>E. of the Cooper Past 41
                          <OPTION value=42>E. of the Cooper To 41
                          <OPTION value=43>Sullivan's Island
                              <OPTION value=44>Isle Of Palms
                              <OPTION value=45>Wild Dunes
                              <OPTION value=46>Dewees Island
                              <OPTION value=47>Awendaw/McClellanville
                              <OPTION value=51>Peninsula Below Crosstown
                              <OPTION value=52>Peninsula Above Crosstown
                              <OPTION value=61>Dorch. Rd Below Ladson Rd
                              <OPTION value=62>Dorch. Cnty-Ladson Bacons Brdg
                              <OPTION value=63>Bacons Brdg/Four Hole Swamp
                              <OPTION value=64>Dorch. Cnty Above Four Hole
                              <OPTION value=71>Hanahan
                              <OPTION value=72>S.E. Goose Creek
                              <OPTION value=73>N.W. Goose Creek
                              <OPTION value=74>Berkeley Triangle 17AC
                              <OPTION value=75>Rural Berkeley County
                              <OPTION value=76>Moncks Corner & Pinopolis
                              <OPTION value=77>Daniel Island
                              <OPTION value=81>Out Of Tri-County Area
                              <OPTION value=82>Colleton County
                              <OPTION value=83>Orangeburg County
                              </OPTION></SELECT>

              &nbsp;<B>TYPE: </B>
              <SELECT name=LIST_TYPE>
                        <OPTION value="<%=request.Form("sLIST_TYPE")%>" selected>Select...
                              <OPTION value=SFR>Single Family Residential
                              <OPTION value=TOWN>Townhouse
                              <OPTION value=COVI>Condo/Villa
                              <OPTION value=DUPL>Duplex
                              <OPTION value=TRIP>Triplex
                              <OPTION value=QUAD>Quadriplex
                              <OPTION value=VAC>Vacation Property
                              <OPTION value=MOBI>Mobile Home
                              <OPTION value=LOT>Lots
                              <OPTION value=MULT>Multi Unit
                              <OPTION value=COMM>Commercial/Investment
                              </OPTION></SELECT>
              &nbsp; </td>
          </tr>
          <tr>
            <td bgcolor="F0F0F0" nowrap class="small" colspan="2"> &nbsp;&nbsp;<B>BEDROOMS:
              </B>
              <SELECT name=BR>
                        <OPTION value="<%=request.Form("sBR")%>" selected>None
                          <OPTION value=1>1+
                              <OPTION value=2>2+
                              <OPTION value=3>3+
                              <OPTION value=4>4+
                              <OPTION value=5>5+
                              <OPTION value=6>6+
                              <OPTION value=7>7+
                              <OPTION value=8>8+
                              <OPTION value=9>9+
                          </OPTION></SELECT>
              <B>&nbsp;&nbsp;&nbsp;&nbsp;BATHS: </B>
              <SELECT name=BA>
                           <OPTION value="<%=request.Form("sBA")%>" selected>None
                           <OPTION value=1>1+
                              <OPTION value=2>2+
                              <OPTION value=3>3+
                              <OPTION value=4>4+
                              <OPTION value=5>5+
                              <OPTION value=6>6+
                              <OPTION value=7>7+
                              <OPTION value=8>8+
                              <OPTION value=9>9+
                          </OPTION></SELECT>
              &nbsp;&nbsp; <B>SQUARE FEET: </B> <select name=SQFT>
                <option value="<%=request.Form("sSQFT")%>" selected>None
                <option value=500>&nbsp;&nbsp;500+
                <option value=1000>1000+
                <option value=1500>1500+
                <option value=2000>2000+
                <option value=3000>3000+
                <option value=4000>4000+
                <option value=5000>5000+
                <option value=7500>7500+
                <option value=10000>10,000+ </option>
              </select></TD>
          </tr>
              <tr>
                <td bgcolor="F0F0F0" nowrap class="small" colspan="2"> <B>&nbsp;&nbsp;MINIMUM
              PRICE: </B>
              <SELECT name=LPRICE>
                        <OPTION value="<%=request.Form("sLPRICE")%>" selected>None
                              <OPTION value=50000>&nbsp;&nbsp;50K or more
                              <OPTION value=100000>100K or more
                              <OPTION value=150000>150K or more
                              <OPTION value=200000>200K or more
                              <OPTION value=250000>250K or more
                              <OPTION value=300000>300K or more
                              <OPTION value=350000>350K or more
                              <OPTION value=400000>400K or more
                              <OPTION value=450000>450K or more
                              <OPTION value=500000>500K or more
                              <OPTION value=600000>600K or more
                              <OPTION value=700000>700K or more
                              <OPTION value=800000>800K or more
                              <OPTION value=900000>900K or more
                              <OPTION value=1000000>1 Mil or more
                              <OPTION value=1250000>1.25 Mil or more
                              <OPTION value=1500000>1.50 Mil or more
                              <OPTION value=1750000>1.75 Mil or more
                              <OPTION value=2000000>2 Mil or more
                              <OPTION value=2500000>2.5 Mil or more
                              <OPTION value=3000000>3 Mil or more
                              <OPTION value=3500000>3.5 Mil or more
                              <OPTION value=40000000>4 Mil or more
                              <OPTION value=45000000>4.5 Mil or more
                              <OPTION value=50000000>5 Mil or more
                              </OPTION></SELECT>
              <B>&nbsp;&nbsp;&nbsp;MAXIMUM PRICE: </B>
              <SELECT name=HPRICE>
                        <OPTION value="<%=request.Form("sHPRICE")%>" selected>None
                              <OPTION value=50000>&nbsp;&nbsp;50K or less
                              <OPTION value=100000>100K or less
                              <OPTION value=150000>150K or less
                              <OPTION value=200000>200K or less
                              <OPTION value=250000>250K or less
                              <OPTION value=300000>300K or less
                              <OPTION value=350000>350K or less
                              <OPTION value=400000>400K or less
                              <OPTION value=450000>450K or less
                              <OPTION value=500000>500K or less
                              <OPTION value=600000>600K or less
                              <OPTION value=700000>700K or less
                              <OPTION value=800000>800K or less
                              <OPTION value=900000>900K or less
                              <OPTION value=1000000>1 Mil or less
                              <OPTION value=1250000>1.25 Mil or less
                              <OPTION value=1500000>1.50 Mil or less
                              <OPTION value=1750000>1.75 Mil or less
                              <OPTION value=2000000>2 Mil or less
                              <OPTION value=2500000>2.5 Mil or less
                              <OPTION value=3000000>3 Mil or less
                              <OPTION value=3500000>3.5 Mil or less
                              <OPTION value=40000000>4 Mil or less
                              <OPTION value=45000000>4.5 Mil or less
                              <OPTION value=50000000>5 Mil or less
                              </OPTION></SELECT>
              </td>
              </tr>
          <tr valign="center">
            <td bgcolor="f0f0f0" nowrap class="small" colspan="2"> &nbsp;&nbsp;<b>STREET
              NAME: </b>
              <input type="Text" name="ST_NAME" size="20" value="<%=request.Form("sST_NAME")%>">
              &nbsp;&nbsp;PROPERTY ID: </b>
              <input type="Text" name="CHHID" size="14" value="<%=request.Form("sCHHID")%>">
              </TD></TR>
                    <TR>
            <td bgcolor="F0F0F0" nowrap class="small" colspan="2">&nbsp;&nbsp;
              <input name="submit" type="submit" value="Search"> &nbsp;&nbsp;&nbsp;[<a href="search_main_results_sort.asp">CLEAR
              SEARCH</a>] </td>  
          </tr>
        </form>
        <tr>
          <td align="right" background="/CHHfiles/charlestonhomehunters/images/tab_bottom2.gif" colspan="2"><img
      src="/CHHfiles/charlestonhomehunters/search_files/tab_bottom.gif" border="0" align="top" width="100" height="8"></td>
        </tr>
  </table>
</div>
<div align="center">
<br>
  <table border="0" cellpadding="2" cellspacing="2" width="100%">
    <tr>
      <td background="/CHHfiles/charlestonhomehunters/images/tab_top2.gif" class="WhiteMedHeader" colspan="2" bgcolor="000000">Property
        Results:</td>
      <td width="9%" bgcolor="white">&nbsp;</td>
      <td width="9%" bgcolor="white">&nbsp;</td>
      <td width="10%" bgcolor="white"><img src="/CHHfiles/charlestonhomehunters/Search_files/icon_back2.gif" width="49" height="22" align="right"></td>
      <td width="22%" align="center" nowrap bgcolor="ffffff" class="small"><b>Showing
        1-10 of 418</b> </td>
          <img src="/CHHfiles/charlestonhomehunters/Search_files/icon_next.gif" width="47" height="22">
      <form action="Search_main_Results_Sort.asp" method="post">
        <td align=left class="small" bgcolor="ffffff"><input type="Hidden" name="page" value="2">
          <input type="Hidden" name="MLS" value="<%=request.Form("sMLS")%>"> <input type="Hidden" name="BR" value="<%=request.Form("sBR")%>">
          <input type="Hidden" name="SQFT" value="<%=request.Form("sSQFT")%>"> <input type="Hidden" name="LPRICE" value="<%=request.Form("sLPRICE")%>">
          <input type="Hidden" name="HPRICE" value="<%=request.Form("sHPRICE")%>"> <input type="Hidden" name="ST_NAME" value="<%=request.Form("sST_NAME")%>">
          <input type="Hidden" name="CHHID" value="<%=request.Form("sCHHID")%>"><input type="Hidden" name="LISTING_TYPE" value="<%=sLISTING_TYPE%>">
              <input type="Hidden" name="BA" value="<%=request.Form("sBA")%>">
        </td>
      </form>
    </tr>
    <tr valign="middle" bgcolor="Silver" class="small">
      <td width="12%" nowrap class="small">
        <div align="center"><b>PHOTO</b></div></td>
      <td width="24%" nowrap class="small"><div align="center"><b>AREA</b></div></td>
      <td nowrap class="small">
        <div align="center"><b><a href="Search_main_Results_Sort.asp?Sort=BR_a"><img src="/Images/Down.jpg" align="middle"></a>&nbsp;BR&nbsp;<a href="Search_main_Results_Sort.asp?Sort=BR_d"><img src="/Images/Up.jpg" align="middle"></a></b></div></td>
      <td nowrap class="small">
        <div align="center"><b><a href="Search_main_Results_Sort.asp?Sort=BA_a"><img src="/Images/Down.jpg" align="middle"></a>&nbsp;BA&nbsp;<a href="Search_main_Results_Sort.asp?Sort=BA_d"><img src="/Images/Up.jpg" align="middle"></a></b></div></td>
      <td nowrap class="small">
        <div align="center"><b><a href="Search_main_Results_Sort.asp?Sort=SQFT_a"><img src="/Images/Down.jpg" align="middle"></a>&nbsp;SQFT&nbsp;<a href="Search_main_Results_Sort.asp?Sort=SQFT_d"><img src="/Images/Up.jpg" align="middle"></a></b></div></td>
      <td nowrap class="small">
        <div align="center"><b>CONTACT</b></div></td>
      <td nowrap class="small">
        <div align="center"><b><a href="Search_main_Results_Sort.asp?Sort=PRICE_a"><img src="/Images/Down.jpg" align="middle"></a>&nbsp;PRICE&nbsp;<a href="Search_main_Results_Sort.asp?Sort=PRICE_d"><img src="/Images/Up.jpg" align="middle"></a></b></div></td>
    </tr>
    <%
set objRec = server.CreateObject("ADODB.Recordset")
objRec.ActiveConnection = "dsn=chh_db;uid=chhteam;pwd=listings;network=dbmssocn"

'declare the variables
dim objCon
dim objRec
dim strSQL
dim strSort 'this variable is INCASE you sort
DIM strSortBy, tmpSortBy
strSortBy = Request.Form("Sort")
Select Case strSortBy
Case "BR_a"
tmpSortBy = "ORDER BY BR ASC"
Case "BR_d"
tmpSortBy = "ORDER BY BR DESC"
Case "BA_a"
tmpSortBy = "ORDER BY BA ASC"
Case "BA_d"
tmpSortBy = "ORDER BY BA DESC"
Case "SQFT_a"
tmpSortBy = "ORDER BY SQFT ASC"
Case "SQFT_d"
tmpSortBy = "ORDER BY SQFT DESC"
Case "PRICE_a"
tmpSortBy = "ORDER BY PRICE ASC"
Case "PRICE_d"
tmpSortBy = "ORDER BY PRICE DESC"
Case Else
tmpSortBy = "ORDER BY PRICE DESC"
End Select

strSQL  = "SELECT CHHID, " & _
                  "PQUEST, " & _
                  "EXTN, " & _
                  "SRCE, " & _
                  "sLOCATION, " & _
                  "CONTACT01, " & _
                  "TITLE01, " & _
                  "PHONE01, " & _
                  "CONTACT02, " & _
                  "TITLE02, " & _
                  "PHONE02, " & _
                  "CONTACT03, " & _
                  "TITLE03, " & _
                  "PHONE03, " & _
                  "PROP_TYPE, " & _
                  "PRICE, " & _
                  "SUBDIVISION, " & _
                  "ST_NU, " & _
                  "ST_NAME, " & _
                  "ST_TYPE, " & _
                  "CITY, " & _
                  "sSTATE, " & _
                  "ZIP, " & _
                  "ZONE_TYPE, " & _
                  "SQFT, " & _
                  "BR, " & _
                  "BA, " & _
                  "TAXES, " & _
                  "LIST_TYPE, " & _
                  "YRBLT, " & _
                  "FR, " & _
                  "LR, " & _
                  "FP, " & _
                  "FLOOR, " & _
                  "LNDRY, " & _
                  "AIR, " & _
                  "HEAT, " & _
                  "RNGE, " & _
                  "OVN, " & _
                  "DW, " & _
                  "DSPSL, " & _
                  "TRSH, " & _
                  "MCRWV, " & _
                  "RFRG, " & _
                  "INT_FTRS, " & _
                  "OTHR_APP, " & _
                  "LT_ACRS, " & _
                  "LT_DSCRP, " & _
                  "LT_DMNS, " & _
                  "FNCE, " & _
                  "GAR, " & _
                  "SPRNK, " & _
                  "RDACC, " & _
                  "EXTR, " & _
                  "ROOF, " & _
                  "WTR_SWG, " & _
                  "PIC_TTL_01, " & _
                  "TN_PIC_01, " & _
                  "PIC_01, " & _
                  "PIC_TTL_02, " & _
                  "TN_PIC_02, " & _
                  "PIC_02, " & _
                  "PIC_TTL_03, " & _
                  "TN_PIC_03, " & _
                  "PIC_03, " & _
                  "PIC_TTL_04, " & _
                  "TN_PIC_04, " & _
                  "PIC_04, " & _
                  "PIC_TTL_05, " & _
                  "TN_PIC_05, " & _
                  "PIC_05, " & _
                  "PIC_TTL_06, " & _
                  "TN_PIC_06, " & _
                  "PIC_06, " & _
                  "PIC_TTL_07, " & _
                  "TN_PIC_07, " & _
                  "PIC_07, " & _
                  "PIC_TTL_08, " & _
                  "TN_PIC_08, " & _
                  "PIC_08, " & _
                  "PIC_TTL_09, " & _
                  "TN_PIC_09, " & _
                  "PIC_09, " & _
                  "PIC_TTL_10, " & _
                  "TN_PIC_10, " & _
                  "PIC_10, " & _
                  "PIC_TTL_11, " & _
                  "TN_PIC_11, " & _
                  "PIC_11, " & _
                  "PIC_TTL_12, " & _
                  "TN_PIC_12, " & _
                  "PIC_12, " & _
                  "PIC_TTL_13, " & _
                  "TN_PIC_13, " & _
                  "PIC_13, " & _
                  "PIC_TTL_14, " & _
                  "TN_PIC_14, " & _
                  "PIC_14, " & _
                  "CMT01, " & _
                  "CMT02, " & _
                  "CMT03, " & _
                  "CMT04, " & _
                  "CMT05, " & _
                  "CMT06, " & _
                  "CMT07, " & _
                  "CMT08 " & _
                  "FROM Properties "
strSQL = strSQL & "WHERE 1 = 1 "
If Len(Request("MLS")) > 0 Then strSQL = strSQL & "AND (MLS = '" & Request("MLS") & "' ) "
If Len(Request("CHHID")) > 0 Then strSQL = strSQL & "AND (CHHID = '" & Request("CHHID") & "' ) "
If Len(Request("ST_NAME")) > 0 Then strSQL = strSQL & "AND (ST_NAME = '" & Request("ST_NAME") & "' ) "
If Len(Request("LIST_TYPE")) > 0 Then strSQL = strSQL & "AND (LIST_TYPE = '" & Request("LIST_TYPE") & "' ) "
If Len(Request("BR")) > 0 Then strSQL = strSQL & "AND (BR >= '" & Request("BR") & "' ) "
If Len(Request("BA")) > 0 Then strSQL = strSQL & "AND (BA >= '" & Request("BA") & "' )  "
If Len(Request("SQFT")) > 0 Then strSQL = strSQL & "AND (SQFT >= '" & Request("SQFT") & "' ) "
If Len(Request("LPRICE")) > 0 Then strSQL = strSQL & "AND (PRICE >= '" & Request("LPRICE") & "' ) "
If Len(Request("HPRICE")) > 0 Then strSQL = strSQL & "AND (PRICE <= '" & Request("HPRICE") & "' ) " 
'if Len(Request("SortBy")) > 0 then
'   strSQL = strSQL & "ORDER BY ('" & Request("SortBy") & "') "
'   else
   strSQL = strSQL & tmpSortBy
'end if

'strSQL = strSQL & "ORDER BY ('" & Request("SortBy") & "') ; "

'open the recordset object
'objRec.Open strSQL, objCon, 3
objRec.CursorType = 0
objRec.CursorLocation = 2
objRec.LockType = 3
objRec.Open strSQL
'check if the recordset object returned any records
'if objRec.EOF then
  'if there are no records display a message and stop
  'processing the page
'  Response.Write  "No records available"
'  Response.End
'end if

While Not objRec.EOF
if x = 1 then
sBgcolor="E8E8E8"
x=2
Else
sBgcolor="F7F7F7"
x=1
End if

Response.Write "<tr class=return bgcolor="&sBgcolor&">"

%>
    <td class="small"><a href="http://www.charlestonhomehunters.com/HomeView.asp?homeviewid=<%=objRec("CHHID")%>" onClick="popup = window.open('http://charlestonhomehunters.com/HomeView.asp?homeviewid=<%=objRec("CHHID")%>', 'PopupPage', 'height=550,width=590,scrollbars=yes,resizable=yes'); return false" target="_blank">
      </a><a href="http://www.charlestonhomehunters.com/HomeView.asp?homeviewid=<%=objRec("CHHID")%>" onClick="popup = window.open('http://charlestonhomehunters.com/HomeView.asp?homeviewid=<%=objRec("CHHID")%>', 'PopupPage', 'height=550,width=590,scrollbars=yes,resizable=yes'); return false" target="_blank"><img src="/<%=objRec("PROP_TYPE")%>/<%=objRec("CHHID")%>/<%=objRec("TN_PIC_01")%>" width="85" height="64" border="0"></a>
    </td>
    <td class="small" nowrap> <b><%=objRec("sLOCATION")%></b><br> <a href="http://www.charlestonhomehunters.com/HomeView.asp?homeviewid=<%=objRec("CHHID")%>" onClick="popup = window.open('http://www.charlestonhomehunters.com/HomeView.asp?homeviewid=<%=objRec("CHHID")%>', 'PopupPage', 'height=550,width=590,scrollbars=yes,resizable=yes'); return false" target="_blank"><span class="bodylink"><%=objRec("ST_NU")%>&nbsp;<%=objRec("ST_NAME")%>&nbsp;<%=objRec("ST_TYPE")%></span></a><br> <%=objRec("CITY")%>,&nbsp;<%=objRec("sSTATE")%>&nbsp;<%=objRec("ZIP")%><br> <b><%=objRec("SUBDIVISION")%></b><br> <b>CHH#:</b>&nbsp;<%=objRec("CHHID")%></td>
      <td valign="top" nowrap class="small"> <br>
        <%=objRec("BR")%></td>
      <td valign="top" nowrap class="small"><br>
        <%=objRec("BA")%></td>
      <td valign="top" nowrap class="small"><br>
        <%=FormatNumber(objRec("SQFT"),0)%></td>
      <td valign="top" nowrap class="small"><br>
        <%=objRec("CONTACT01")%><br> <%=objRec("PHONE01")%><br> <%=objRec("CONTACT02")%><br> <%=objRec("PHONE02")%><br> </td>
      <td valign="top" nowrap class="small"><br>
        <%=FormatCurrency(objRec("PRICE"), 0)%>
<div align="center"></div></td>
    </tr>
    <%
iCount = iCount + 1
objRec.MoveNext
Wend
objRec.Close
set objRec = Nothing
%>
    <tr>
      <td align="right" background="/CHHfiles/charlestonhomehunters/images/tab_bottom2.gif" colspan="7"><img
src="/CHHfiles/charlestonhomehunters/search_files/tab_bottom.gif" border="0" align="top" width="100" height="8"></td>
    </tr>
    <tr>
      <td colspan="2" class="small" bgcolor="ffffff">&nbsp;</td>
      <td bgcolor="white">&nbsp;</td>
      <td bgcolor="white">&nbsp;</td>
      <td bgcolor="white" class="small"><img src="/CHHfiles/charlestonhomehunters/Search_files/icon_back2.gif" width="49" height="22" align="right"></td>
      <td align="center" nowrap bgcolor="ffffff" class="small"><b>Showing 1-10
        of 418</b> </td>
      <td bgcolor="white"><img src="/CHHfiles/charlestonhomehunters/Search_files/icon_next.gif" width="47" height="22"></td>
    </tr>
  </table>
</div>
<!-- FOOTER -->
<TABLE width="100%">
<TR>
<TD width=5 bgcolor="f0f0f0" class="small"><img src="/CHHfiles/charlestonhomehunters/images/blank.gif" width=5 height=1 border=0>
</TD></TR>
<TR>
  <TD colspan=4 class="smallgray"><!--#include file="Includes/footer.asp"--></TD>
</TR>
</TABLE>
</body></html>
0
 
LVL 60

Expert Comment

by:Julian Hansen
ID: 12603392
Thanks for the code - you posted that already - what I meant in my earlier post was could you just say where the hidden fields stuff was done (example line 78). However, I did find what I was looking for.

Can you confirm when the form comes back that the hidden fields have been set correctly?

i.e. after choosing CHARLESTON AREA you get 3 records. Do a view source and check the values of the hidden fields.

Now click sort and when the page comes back check again.

Are the fields definitely being set.

Also check that they are spelled correctly.
0
 

Author Comment

by:javajamminman
ID: 12605121
okay, gotcha. I posted a second time to show you in the code where I had added the hidden fields. I did not have them in there the first time.

0
 
LVL 60

Expert Comment

by:Julian Hansen
ID: 12607669
oic - I probably would have difficulty finding it in the original post then ;)

Anyway, try the view source to see what you are getting back at each stage.
0

Featured Post

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What we learned in Webroot's webinar on multi-vector protection.
How much do you know about the future of data centers? If you're like 50% of organizations, then it's probably not enough. Read on to get up to speed on this emerging field.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question