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

x
?
Solved

Search functionality works fine in winwap but not in mobile phone

Posted on 2005-05-15
4
Medium Priority
?
383 Views
Last Modified: 2013-12-27
We have developed a search based website( www.roadside.bz). We developed similar search in wap. We used Post method and also get method. Both these methods do not work in mobile phone. Get method works in openwave simulator and post method works in winwap.

The flow is once you type the url in browser then it should give you a link to search and other to paypal. Click on search, then it should take you to categories, then sub category, then state, city, service type, distance and finally results. Papal link works fine. Only problem is with search link.

I am here by putting the code for both methods seperately. Pl. debug and let me know where the probelm lies

This two methods are already in server. You can test them with this urls

Get method: www.roadside.bz/wap/main.wml
Post method: www.roadside.bz/wap/main1.wml

GET METHOD
**************
<% Response.ContentType = "text/vnd.wap.wml" %>
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<!-- #Include File="TrucksConnFile.asp" -->
<wml>
  <card id="card1" title="Master Category">
            <do type="accept" label="Select Category">
                  <go method="get" href="#card2" >
                        <postfield name="MasterCategory" value="$MasterCategory" />
                  </go>
            </do>      
            <p>
                  Select Master Category: <br/>
                  <select name="MasterCategory" value="Select Category">
                        <%
                              set rs = Server.CreateObject("ADODB.recordset")
                              sqlQuery = "select distinct MasterCategoryId,MasterCategoryName from tblMasterCategories"
                              rs.Open sqlQuery, Conn
                                                                              
                              if not (rs.BOF = true and rs.EOF = true) then
                                    do until rs.EOF
                                          Response.Write "<option value='" & rs("MasterCategoryID") &"' >" & rs("MasterCategoryName") & "</option>"
                                                rs.MoveNext
                                    loop
                                    rs.Close      
                              end if
                        %>            
                  </select>      
            </p>
      </card>
      <card id="card2" title="Sub Category">
             <do type="prev"><prev/></do>       
             <do type="accept" label="Select States">
                  <go method="get" href="#card3" >
                  <postfield name="SubCategory" value="$SubCategory" />
                  </go>
             </do>      
                  
            <p>
                  Select Sub Category: <br/>
                  <select name="SubCategory">
                  <%
                        set rs = Server.CreateObject("ADODB.recordset")
                        
                        Mid1 = cint(Request.QueryString("MasterCategory"))
                        Session("MasterCategory") = Mid1

                        if (Mid1 > 0 ) then                        
                              sqlQuery = "select SubCategoryID  from tblcategoryMapping  where MasterCategoryId=" & cint(Mid1)
                              rs.Open sqlQuery, Conn
                              if not (rs.BOF = true and rs.EOF = true) then
                                    do until rs.EOF
                                          bname = ReturnBusinessName(rs("SubCategoryID"))
                                          Response.Write "<option value='" & rs("SubCategoryID") &"' >" & bname & "</option>"
                                          rs.MoveNext
                                    loop
                                    rs.Close      
                              end if
                        else
                              Response.Write "<option value='0'>No Reocrds</option>"
                        end if
                  
                  %>
                  </select>      
       </p>
       </card>
        <card id="card3" title="States">
             <do type="prev"><prev/></do>
             <do type="accept" label="Select Cities">
                  <go method="get" href="#card6" >
                        <postfield name="StateId" value="$StateId" />
                  </go>
             </do>
            <p>
                  <select name="StateId" >
                  <%
                        scatid = Request.QueryString("SubCategory")
                        Session("SubCategory") = scatid
                  
                        set rs = Server.CreateObject("ADODB.recordset")
                        sqlQuery = "select * from tblStateNames order by StateFullName"
                        rs.Open sqlQuery, Conn      
                        if not (rs.BOF = true and rs.EOF = true) then
                              do until rs.EOF
                                    Response.Write "<option value='" & rs("StateID") &"' >" & rs("StateFullName") & "</option>"
                                    rs.MoveNext
                              loop
                              rs.Close      
                        end if
            %>
                  </select>
            </p>
     </card>
     
 <card id="card6" title="Select City">
      <do type="accept" label="Select City">
            <go method="get" href="#card4" >
                  <postfield name="citylist" value="$citylist" />
            </go>
      </do>      
        <p align="center">
            <%
                  stateid =  Request.QueryString("StateId")
                  Session("StateID") = stateid
            %>
            Select the First Letter of your City:
            <select name="citylist">
                  <option value="A">A</option>
                  <option value="B">B</option>
                  <option value="C">C</option>
                  <option value="D">D</option>
                  <option value="E">E</option>
                  <option value="F">F</option>
                  <option value="G">G</option>
                  <option value="H">H</option>
                  <option value="I">I</option>
                  <option value="J">J</option>
                  <option value="K">K</option>
                  <option value="L">L</option>
                  <option value="M">M</option>
                  <option value="N">N</option>
                  <option value="O">O</option>
                  <option value="P">P</option>
                  <option value="Q">Q</option>
                  <option value="R">R</option>
                  <option value="S">S</option>
                  <option value="T">T</option>
                  <option value="U">U</option>
                  <option value="V">V</option>
                  <option value="W">W</option>
                  <option value="X">X</option>
                  <option value="Y">Y</option>
                  <option value="Z">Z</option>
            </select>
  </p>
  </card>
    <card id="card4" title="Cities">
            <do type="prev"><prev/></do>
            <do type="accept" label="Show Results">
                  <go method="get" href="#card5" >
                        <postfield name="CityID" value="$CityID" />
                        <postfield name="SetviceTypeID" value="$SetviceTypeID" />
                        <postfield name="Distance" value="$Distance" />
                  </go>
             </do>
                  <%
                        cityname = Request.QueryString("citylist")

                        stateid = Session("StateID")
                        if stateid > 0 then
                        %>
                        <p>
                              City:
                              <select name="CityID" >
                              <%                                    
                                          set rs = Server.CreateObject("ADODB.recordset")
                                          sqlQuery = "Select distinct d.city  from distance d ,tblStatenames t where t.StateShortName=d.state and t.StateID=" & cint(stateid) &" and d.city like '"& cityname &"%' "

                                          rs.Open sqlQuery, Conn      
                                          if not (rs.BOF = true and rs.EOF = true) then
                                                do until rs.EOF
                                                      Response.Write "<option value='" & rs("city") &"' >" & rs("city") & "</option>"
                                                      rs.MoveNext
                                                loop
                                                rs.Close      
                                          end if
                              %>
                              </select>
                  </p>
                  <p>
                        Service Type:
                              <select name="SetviceTypeID" >
                              <%
                                          set rs = Server.CreateObject("ADODB.recordset")
                                          sqlQuery = "select * from tblServiceTypes"
                                          rs.Open sqlQuery, Conn      
                                          if not (rs.BOF = true and rs.EOF = true) then
                                                do until rs.EOF
                                                      Response.Write "<option value='" & rs("ServiceTypeID") &"' >" & rs("ServiceType") & "</option>"
                                                      rs.MoveNext
                                                loop
                                                rs.Close      
                                          end if
                              %>
                              </select>
                  </p>
                  <p>
                        Distance:
                          <select name="Distance" >
                                <option value="0">0</option>
                                <option value="25">25</option>
                                <option value="50">50</option>
                                <option value="75">75</option>
                                <option value="100">100</option>
                                <option value="150">150</option>
                         </select>
                  </p>
                  <% end if %>
       </card>
         <card id="card5" title="Show Results">
         <do type="prev"><prev/></do>
               <p>
               <%
                        CityName = Request.QueryString("CityID")
                        ServiceType = Request.QueryString("SetviceTypeID")
                        distance_no = Request.QueryString("Distance")
                        
                        strMid = Session("MasterCategory")
                        strSubCat = Session("SubCategory")
                        StateName = Session("StateID")
                  
                        if (cint(distance_no) <= 0 ) then
                              set rs = Server.CreateObject("ADODB.recordset")
                                    sqlQuery = "Select distinct t.BusinessId,t.BusinessName,t.ListingCity,t.address,t.phone1,t.phone2, e.ServiceType,s.statefullname   from tblBusiness t,tblstateNames s,tblCategoryMapping g,tblServiceTypes e   where  e.ServiceTypeID=t.ServiceTypeId and  t.hidden=0   and t.ListingState=s.Stateid and g.MastercategoryId=t.MasterCategoryid and t.ListingState=s.Stateid and t.MasterCategoryID="& cint(strMid) &" and g.SubCategoryId="& cint(strSubCat) &" and s.StateId="& cint(StateName) &  " and  t.ListingCity='"& CityName &"' and t.Servicetypeid="& cint(ServiceType)
                              
                                    rs.Open sqlQuery, Conn      
                                    if not (rs.BOF = true and rs.EOF = true) then
                                          do until rs.EOF
                                                Response.Write "S Type:" & rs("ServiceType") &"<br/>"
                                                Response.Write "B Name:" & rs("BusinessName") &"<br/>"
                                                Response.Write "Address:" & rs("address") &"<br/>"
                                                Response.Write "City:" & rs("ListingCity") &"<br/>"
                                                Response.Write "State:" & rs("statefullname") &"<br/>"
                                                Response.Write "PNo:" & rs("phone1") &"<br/>"
                                                Response.Write "<br/>&nbsp;<br/>"
                                                rs.MoveNext
                                          loop
                                          rs.Close
                                    else
                                          Response.Write "No Records Found"
                                    end if
                        else
                                    set Rs = Server.CreateObject("ADODB.recordset")
                                    sqlQuery = "select d.longitude,d.attitude, d.zip, d.state,d.city from Distance d, tblStateNames s where s.stateshortname = d.state and d.city = 'ABBEVILLE' and s.StateID = 1"
                                    Rs.Open sqlQuery, Conn
                                          
                                    if Not (Rs.BOF = true and Rs.EOF = true ) then
                                                N11 = Rs("longitude")
                                                L11 = Rs("attitude")
                                                Zip = Rs("zip")
                                    else
                                                N11 = 0
                                                L11 = 0
                                    end if
                                    Rs.Close             
      
                                    if (zip <> "" and zip > 0) then
                                          if zip > 501 then
                                                FromZip = zip - 500
                                                ToZip = zip + 1000
                                          else
                                                FromZip = 1
                                                ToZip = zip + 500
                                          end if
                                    end if
                                                                  
                                    sqlDis = "select * from calc_dist_test("& N11 &","& L11 &"," & StateName & ","& distance_no &"," & ServiceType & ","& strMid &","& strSubCat &","& FromZip &","& ToZip &") order by Distance"
                                    
                                    '"select * from calc_dist_test(-111.535089,33.408443,3,150,1,1,1,84720,86220) order by Distance"
                                    Set Rsdis = Server.CreateObject("ADODB.RecordSet")
                                    Rsdis.Open sqlDis, Conn
                                    if (Rsdis.BOF = true and Rsdis.EOF = true) then
                                                Response.Write "No Records Found"
                                    else
                                                do until Rsdis.EOF
                                                      Response.Write "S Type:" & Rsdis("ServiceType") &"<br/>"
                                                      Response.Write "B Name:" & Rsdis("BusinessName") &"<br/>"
                                                      Response.Write "Address:" & Rsdis("address") &"<br/>"
                                                      Response.Write "City:" & Rsdis("ListingCity") &"<br/>"
                                                      Response.Write "State:" & Rsdis("statefullname") &"<br/>"
                                                      Response.Write "PNo:" & Rsdis("phone1") &"<br/>"
                                                      Response.Write "Distance:" & Rsdis("Distance") &"<br/>"
                                                      Response.Write "<br/>&nbsp;<br/>"
                                                
                                                      Rsdis.MoveNext
                                                loop
                                    end if
                        end if
                  %>
            
                  </p>
            </card>
  </wml>
 
<%
 
  function ReturnBusinessName(objbid)
      bname = ""
      if objbid > 0 then
            Set rsb = Server.CreateObject("ADODB.RecordSet")
            rsb.Open "Select SubCategoryName from TblSubCategories where SubCategoryID="& objbid, conn
            if not (rsb.BOF = true and rsb.EOF = true) then
                  bname = rsb("SubCategoryName")
            end if
            rsb.Close()
      end if
      ReturnBusinessName = bname
  end function
 
%>
 
POST METHOD
************
<% Response.ContentType = "text/vnd.wap.wml" %>
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<!-- #Include File="TrucksConnFile.asp" -->
<wml>
<% if Request("cardno")=1 then%>
  <card id="card1" title="MasterCategory" >
            <do type="accept" label="Go">
                  <go method="post" href="wapcategorynew1.asp?cardno=2&MasterCategory=$(MasterCategory)" >
                        <postfield name="MasterCategory" value="$(MasterCategory)"/>
                  </go>
            </do>      
            <p>
                  Select Master Category: <br/>
                  <select name="MasterCategory">
                        <%
                              set rs = Server.CreateObject("ADODB.recordset")
                              sqlQuery = "select distinct MasterCategoryId,MasterCategoryName from tblMasterCategories"
                              rs.Open sqlQuery, Conn
                                                                              
                              if not (rs.BOF = true and rs.EOF = true) then
                                    do until rs.EOF
                                          Response.Write "<option value='" & rs("MasterCategoryID") &"' >" & rs("MasterCategoryName") & "</option>"
                                                rs.MoveNext
                                    loop
                                    rs.Close      
                              end if
                        %>            
                  </select>      
            </p>
      </card>
<% elseif Request("cardno")=2 then%>
     <card id="card2" title="Sub Category" newcontext="false" >
             <do type="prev"><prev/></do>       
             <do type="accept" label="Go">
                  <go method="post" href="wapcategorynew1.asp?cardno=3&MasterCategory=$MasterCategory1&SubCategory=$SubCategory"  >
                  <postfield name="SubCategory" value="$SubCategory" />
                  <setvar name="MasterCategory1" value="<%=Request.QueryString("MasterCategory")%>"/>
                  <postfield name="MasterCategory" value="$MasterCategory1"/>
                  </go>
             </do>      
                  <%
                        'Response.write cint(Request.QueryString("MasterCategory"))
                        'Response.write cint(Request.Form("MasterCategory"))
                        'Response.write cint(Request("MasterCategory"))
                        
                  %>
            <p>
                  Select Sub Category: <br/>
                  <select name="SubCategory">
                  <%
                        set rs = Server.CreateObject("ADODB.recordset")
                        
                        Mid1 = cint(Request("MasterCategory"))
                        Session("MasterCategory") = Mid1

                        if (Mid1 > 0 ) then                        
                              sqlQuery = "select SubCategoryID  from tblcategoryMapping  where MasterCategoryId=" & cint(Mid1)
                              rs.Open sqlQuery, Conn
                              if not (rs.BOF = true and rs.EOF = true) then
                                    do until rs.EOF
                                          bname = ReturnBusinessName(rs("SubCategoryID"))
                                          Response.Write "<option value='" & rs("SubCategoryID") &"' >" & bname & "</option>"
                                          rs.MoveNext
                                    loop
                                    rs.Close      
                              end if
                        else
                              Response.Write "<option value='0'>No Reocrds</option>"
                        end if
                  
                  %>
                  </select>      
       </p>
       </card>
<% elseif Request("cardno")=3 then%>
  <card id="card3" title="Select State">
            <do type="accept" label="Go">
                  <go method="post" href="wapcategorynew1.asp?cardno=4&MasterCategory=$(MasterCategory1)&SubCategory=$SubCategory1&statelist=$statelist"  >
                        <postfield name="statelist" value="$statelist" />
                        <setvar name="SubCategory1" value="<%=Request("SubCategory")%>"/>
                        <postfield name="SubCategory" value="$SubCategory1"/>
                        <setvar name="MasterCategory1" value="<%=Request("MasterCategory")%>"/>
                        <postfield name="MasterCategory" value="$MasterCategory1"/>
                  </go>
            </do>      
        <p align="center">
            <%
                  'Response.write Request("MasterCategory") & "Masterc"
                  'Response.write "subcategoryid" & Request("SubCategory")
                  'scatid = Request.QueryString("SubCategory")
                  scatid = Request("SubCategory")
                  Session("SubCategory") = scatid
            %>
            Select the First Letter of your State:
            <select name="statelist">
                  <option value="A">A</option>
                  <option value="B">B</option>
                  <option value="C">C</option>
                  <option value="D">D</option>
                  <option value="E">E</option>
                  <option value="F">F</option>
                  <option value="G">G</option>
                  <option value="H">H</option>
                  <option value="I">I</option>
                  <option value="J">J</option>
                  <option value="K">K</option>
                  <option value="L">L</option>
                  <option value="M">M</option>
                  <option value="N">N</option>
                  <option value="O">O</option>
                  <option value="P">P</option>
                  <option value="Q">Q</option>
                  <option value="R">R</option>
                  <option value="S">S</option>
                  <option value="T">T</option>
                  <option value="U">U</option>
                  <option value="V">V</option>
                  <option value="W">W</option>
                  <option value="X">X</option>
                  <option value="Y">Y</option>
                  <option value="Z">Z</option>
            </select>
  </p>
  </card>
<% elseif Request("cardno")=4 then%>
        <card id="card4" title="States" newcontext="false">
             <do type="prev"><prev/></do>
             <do type="accept" label="Go">
                  <go method="post" href="wapcategorynew1.asp?cardno=5&MasterCategory=$(MasterCategory1)&SubCategory=$SubCategory1&StateId=$(StateId)" >
                        <postfield name="StateId" value="$(StateId)"/>
                        <setvar name="SubCategory1" value="<%=Request("SubCategory")%>"/>
                        <postfield name="SubCategory" value="$SubCategory1"/>
                        <setvar name="MasterCategory1" value="<%=Request("MasterCategory")%>"/>
                        <postfield name="MasterCategory" value="$MasterCategory1"/>
                  </go>
             </do>
            <p>
                  <select name="StateId" >
                  <%
                        statelist = Request.QueryString("statelist")
                        
                        set rs = Server.CreateObject("ADODB.recordset")
                        sqlQuery = "select * from tblStateNames where StateFullName like  '"& statelist &"%' order by StateFullName "
                        rs.Open sqlQuery, Conn      
                        if not (rs.BOF = true and rs.EOF = true) then
                              do until rs.EOF
                                    Response.Write "<option value='" & rs("StateID") &"' >" & rs("StateFullName") & "</option>"
                                    rs.MoveNext
                              loop
                              rs.Close
                        else
                              Response.write "No States Found!... "
                        end if
            %>
                  </select>
            </p>
            
     </card>
<% elseif Request("cardno")=5 then%>
 <card id="card5" title="Select City" newcontext="false">
      <do type="accept" label="Go">
            <go method="post" href="wapcategorynew1.asp?cardno=6&MasterCategory=$(MasterCategory1)&SubCategory=$SubCategory1&stateid=$(StateId)&citylist=$citylist" >
                  <postfield name="citylist" value="$citylist"/>
                  <postfield name="stateid" value="$(StateId)"/>
                  <setvar name="SubCategory1" value="<%=Request("SubCategory")%>"/>
                  <postfield name="SubCategory" value="$SubCategory1"/>
                  <setvar name="MasterCategory1" value="<%=Request("MasterCategory")%>"/>
                  <postfield name="MasterCategory" value="$MasterCategory1"/>
            </go>
      </do>      
        <p align="center">
            <%
                  'response.write Request("StateId") & "here"
                  StateId =  Request("StateId")
                  Session("StateID") = Request.Querystring("StateId")
            %>
            Select the First Letter of your City:
            <select name="citylist">
                  <option value="A">A</option>
                  <option value="B">B</option>
                  <option value="C">C</option>
                  <option value="D">D</option>
                  <option value="E">E</option>
                  <option value="F">F</option>
                  <option value="G">G</option>
                  <option value="H">H</option>
                  <option value="I">I</option>
                  <option value="J">J</option>
                  <option value="K">K</option>
                  <option value="L">L</option>
                  <option value="M">M</option>
                  <option value="N">N</option>
                  <option value="O">O</option>
                  <option value="P">P</option>
                  <option value="Q">Q</option>
                  <option value="R">R</option>
                  <option value="S">S</option>
                  <option value="T">T</option>
                  <option value="U">U</option>
                  <option value="V">V</option>
                  <option value="W">W</option>
                  <option value="X">X</option>
                  <option value="Y">Y</option>
                  <option value="Z">Z</option>
            </select>
  </p>
  </card>
<% elseif Request("cardno")=6 then%>
  <card id="card6" title="Cities" newcontext="false" >
            <do type="prev"><prev/></do>
            <do type="accept" label="Go">
                  <go method="post" href="wapcategorynew1.asp?cardno=7&MasterCategory=$(MasterCategory1)&SubCategory=$SubCategory1&stateid=$stateid1&CityID=$CityID">
                        <postfield name="CityID" value="$CityID"/>
                        <setvar name="stateid1" value="<%=Request("stateid")%>"/>
                        <postfield name="stateid" value="$stateid1"/>
                        <setvar name="SubCategory1" value="<%=Request("SubCategory")%>"/>
                        <postfield name="SubCategory" value="$SubCategory1"/>
                        <setvar name="MasterCategory1" value="<%=Request("MasterCategory")%>"/>
                        <postfield name="MasterCategory" value="$MasterCategory1"/>
                        </go>
                  </go>
             </do>
                  <%
                        'cityname = Request.QueryString("citylist")
                        cityname = Request("citylist")

                        'stateid = Session("StateID")
                        stateid=Request("stateid")
                        'response.write stateid & "here"
                        if stateid > 0 then
                        %>
                        <p>
                              City:
                              <select name="CityID" >
                              <%                                    
                                          set rs = Server.CreateObject("ADODB.recordset")
                                          sqlQuery = "Select distinct d.city  from distance d ,tblStatenames t where t.StateShortName=d.state and t.StateID=" & cint(stateid) &" and d.city like '"& cityname &"%' "
                                          'sqlQuery = "Select distinct d.city ,d.attitude  from distance d ,tblStatenames t where t.StateShortName=d.state and t.StateID=" & cint(stateid) &" and d.city like '"& cityname &"%' "

                                          rs.Open sqlQuery, Conn      
                                          if not (rs.BOF = true and rs.EOF = true) then
                                                do until rs.EOF
                                                      Response.Write "<option value='" & rs("city") &"' >" & rs("city") & "</option>"
                                                      rs.MoveNext
                                                loop
                                                rs.Close      
                                          end if
                              %>
                              </select>
                  </p>
                  
                  <% end if %>
       </card>
            
<% elseif Request("cardno")=7 then%>

            <card id="card7" title="Cities">
                  <do type="prev"><prev/></do>
                  <do type="accept" label="Go">
                        <go method="post" href="wapcategorynew1.asp?cardno=8&MasterCategory=$(MasterCategory1)&SubCategory=$SubCategory1&stateid=$stateid1&CityName=$CityName1&SetviceTypeID=$(SetviceTypeID)">
                              <postfield name="SetviceTypeID" value="$(SetviceTypeID)"/>
                              <setvar name="CityName1" value="<%=Request("CityID")%>"/>
                              <postfield name="CityName" value="$CityName1"/>
                              <setvar name="stateid1" value="<%=Request("stateid")%>"/>
                              <postfield name="stateid" value="$stateid1"/>
                              <setvar name="SubCategory1" value="<%=Request("SubCategory")%>"/>
                              <postfield name="SubCategory" value="$SubCategory1"/>
                              <setvar name="MasterCategory1" value="<%=Request("MasterCategory")%>"/>
                              <postfield name="MasterCategory" value="$MasterCategory1"/>
                        </go>
                   </do>
                  
                  <%
                        'response.write Request("stateid") & Request("CityID") & "Cityname"
                        'CityName = Request.QueryString("CityID")
                        CityName = Request("CityID")
                        'response.write Request.QueryString("CityID") & "1" & Request.form("CityID") & "2" & Request("CityID")
                        Session("CityID") = CityName
                        'response.write "ses" & Session("CityID")
                  %>
                  <p>
                        Service Type:
                              <select name="SetviceTypeID" >
                              <%
                                          set rs = Server.CreateObject("ADODB.recordset")
                                          sqlQuery = "select * from tblServiceTypes"
                                          rs.Open sqlQuery, Conn      
                                          if not (rs.BOF = true and rs.EOF = true) then
                                                do until rs.EOF
                                                      Response.Write "<option value='" & rs("ServiceTypeID") &"' >" & rs("ServiceType") & "</option>"
                                                      rs.MoveNext
                                                loop
                                                rs.Close      
                                          end if
                              %>
                              </select>
                  </p>
       </card>
<% elseif Request("cardno")=8 then%>
         <card id="card8" title="Distance" >
                  <do type="prev"><prev/></do>
                  <do type="accept" label="Go">
                        <go method="post" href="wapcategorynew1.asp?cardno=9&MasterCategory=$MasterCategory1&SubCategory=$SubCategory1&stateid=$stateid1&CityName=$CityName2&ServiceType1=$ServiceType&Distance=$(Distance)" >
                              <postfield name="Distance" value="$(Distance)"/>
                              <setvar name="ServiceType" value="<%=cint(Request("SetviceTypeID"))%>"/>
                              <postfield name="ServiceType1" value="$ServiceType"/>
                              <setvar name="CityName2" value="<%=Request("CityName")%>"/>
                              <postfield name="CityName" value="$CityName2"/>
                              <setvar name="stateid1" value="<%=Request("stateid")%>"/>
                              <postfield name="stateid" value="$stateid1"/>
                              <setvar name="SubCategory1" value="<%=Request("SubCategory")%>"/>
                              <postfield name="SubCategory" value="$SubCategory1"/>
                              <setvar name="MasterCategory1" value="<%=Request("MasterCategory")%>"/>
                              <postfield name="MasterCategory" value="$MasterCategory1"/>
                        </go>
                   </do>
                        
                   <%
                        'response.write request("CityName") & "Cityname"
                        'ServiceType = Request.QueryString("SetviceTypeID")
                        ServiceType = cint(Request("SetviceTypeID"))
                        Session("ServiceType") = ServiceType
                        'response.write "cityname:" & Request.QueryString("CityName") & "1" & Request("CityName")
                   %>
                        
                  <p>
                        Distance:
                          <select name="Distance" >
                                <option value="0">0</option>
                                <option value="25">5</option>
                                <option value="50">10</option>
                                <option value="75">15</option>
                                <option value="100">20</option>
                                <option value="150">25</option>
                         </select>
                   </p>
         </card>
<% elseif Request("cardno")=9 then%>
          <card id="card9" title="Show Results">
                     <do type="prev"><prev/></do>
                     <p>
                         
                           <%
                                    'distance_no = Request.QueryString("Distance")
                                    distance_no = cint(Request("Distance"))
                                    'if Not isNumeric(distance_no) then      distance_no = 0
                                    'CityName = Session("CityID")
                                    'ServiceType = Session("ServiceType")
                                    'strMid = Session("MasterCategory")
                                    'strSubCat = Session("SubCategory")
                                    'StateName = Session("StateID")

                              'response.write "values" &  Request("ServiceType1") & Request("CityName") & Request("stateid")
                              'Response.write "subcategeory" & Request("SubCategory") & "mc:" & Request("MasterCategory")
                              'response.write cint(distance_no) & "here"
                              'response.end
                                    CityName = Request.Querystring("CityName")
                                    ServiceType = Request.Querystring("ServiceType1")
                                    strMid = Request.Querystring("MasterCategory")
                                    strSubCat = Request.Querystring("SubCategory")
                                    StateName = Request.Querystring("stateid")
                                    if strMid="" then
                                          strMid=Session("MasterCategory")
                                    end if
                                    if strSubCat="" then
                                          strSubCat=Session("SubCategory")
                                    end if
                                    if trim(CityName)="" then
                                          'response.write "abc"
                                          CityName=Session("CityID")
                                          'response.write Session("CityID")
                                          'response.end
                                    end if
                                    if trim(StateName)="" then
                                          StateName=Session("StateID")
                                    end if

                              if (cint(distance_no) <= 0 ) then
                                    set rs = Server.CreateObject("ADODB.recordset")
                                    sqlQuery = "Select distinct t.BusinessId,t.BusinessName,t.ListingCity,t.address,t.phone1,t.phone2, e.ServiceType,s.statefullname   from tblBusiness t,tblstateNames s,tblCategoryMapping g,tblServiceTypes e   where  e.ServiceTypeID=t.ServiceTypeId and  t.hidden=0   and t.ListingState=s.Stateid and g.MastercategoryId=t.MasterCategoryid and t.ListingState=s.Stateid and t.MasterCategoryID="& cint(strMid) &" and g.SubCategoryId="& cint(strSubCat) &" and s.StateId="& cint(StateName) &  " and  t.ListingCity='"& CityName &"' and t.Servicetypeid="& cint(ServiceType)
                              
                                    rs.Open sqlQuery, Conn      
                                    if not (rs.BOF = true and rs.EOF = true) then
                                          do until rs.EOF
                                                Response.Write "S Type:" & rs("ServiceType") &"<br/>"
                                                Response.Write "B Name:" & rs("BusinessName") &"<br/>"
                                                Response.Write "Address:" & rs("address") &"<br/>"
                                                Response.Write "City:" & rs("ListingCity") &"<br/>"
                                                Response.Write "State:" & rs("statefullname") &"<br/>"
                                                Response.Write "PNo:" & rs("phone1") &"<br/>"
                                                Response.Write "<br/>&nbsp;<br/>"
                                                rs.MoveNext
                                          loop
                                          rs.Close
                                    else
                                          Response.Write "No Records Found"
                                    end if
                              else
                                    set Rs = Server.CreateObject("ADODB.recordset")
                                    sqlQuery = "select d.longitude,d.attitude, d.zip, d.state,d.city from Distance d, tblStateNames s where s.stateshortname = d.state and d.city = '"& CityName &"' and s.StateID = "& cint(StateName)
                                    'sqlQuery = "select d.longitude,d.attitude, d.zip, d.state,d.city from Distance d, tblStateNames s where s.stateshortname = d.state and d.attitude = "& CityName &" and s.StateID = "& cint(StateName)
                                    'response.write sqlQuery
                                    Rs.Open sqlQuery, Conn
                                          
                                    if Not (Rs.BOF = true and Rs.EOF = true ) then
                                                N11 = Rs("longitude")
                                                L11 = Rs("attitude")
                                                Zip = Rs("zip")
                                    else
                                                N11 = 0
                                                L11 = 0
                                    end if
                                    Rs.Close             
      
                                    if (zip <> "" and zip > 0) then
                                          if zip > 501 then
                                                FromZip = zip - 500
                                                ToZip = zip + 1000
                                          else
                                                FromZip = 1
                                                ToZip = zip + 500
                                          end if
                                    end if
                                                                  
                                    sqlDis = "select * from calc_dist_test("& N11 &","& L11 &"," & StateName & ","& distance_no &"," & ServiceType & ","& strMid &","& strSubCat &","& FromZip &","& ToZip &") order by Distance"
                                    
                                    '"select * from calc_dist_test(-111.535089,33.408443,3,150,1,1,1,84720,86220) order by Distance"
                                    'response.write sqlDis
                                    'response.end
                                    Set Rsdis = Server.CreateObject("ADODB.RecordSet")
                                    Rsdis.Open sqlDis, conn
                                    if (Rsdis.BOF = true and Rsdis.EOF = true) then
                                                Response.Write "No Records Found"
                                    else
                                                do until Rsdis.EOF
                                                      Response.Write "S Type:" & Rsdis("ServiceType") &"<br/>"
                                                      Response.Write "B Name:" & Rsdis("BusinessName") &"<br/>"
                                                      Response.Write "Address:" & Rsdis("address") &"<br/>"
                                                      Response.Write "City:" & Rsdis("ListingCity") &"<br/>"
                                                      Response.Write "State:" & Rsdis("statefullname") &"<br/>"
                                                      Response.Write "PNo:" & Rsdis("phone1") &"<br/>"
                                                      Response.Write "Distance:" & round(Rsdis("Distance")) &"<br/>"
                                                      Response.Write "<br/>&nbsp;<br/>"
                                                
                                                      Rsdis.MoveNext
                                                loop
                                    end if
                        end if
                              %>
                        </p>
            </card>
<%end if%>
        
  </wml>
 
<%
 
  function ReturnBusinessName(objbid)
      bname = ""
      if objbid > 0 then
            Set rsb = Server.CreateObject("ADODB.RecordSet")
            rsb.Open "Select SubCategoryName from TblSubCategories where SubCategoryID="& objbid, conn
            if not (rsb.BOF = true and rsb.EOF = true) then
                  bname = rsb("SubCategoryName")
            end if
            rsb.Close()
      end if
      ReturnBusinessName = bname
  end function
 
%>
 
0
Comment
Question by:anterior
  • 2
2 Comments
 
LVL 15

Accepted Solution

by:
ncoo earned 2000 total points
ID: 14010005
The first problem is your wml code is not valid.

For you main.wml page change it to:

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card title="Roadside.bz">
<p align="center">Welecome to Roadside.bz<br/></p>
<p align="center">
<anchor>Search<go href="http://www.roadside.bz/wap/wapcategorynew1.asp?cardno=1"/></anchor>
</p>
<p align="center">
<anchor>Paypal<go href="https://www.paypal.com/cgi-bin/webscr"/></anchor>
</p>
<p><br/><br/></p>
<p align="center">
<anchor>Subscribe<go href="http://www.roadside.bz/wap/instructions.asp"/></anchor>
</p>
</card>
</wml>

This should work in both emulators.
0
 
LVL 15

Expert Comment

by:ncoo
ID: 14010046
The next problem you have is with the &.

When clicking search, the next page loads but there is an error:

<go method="post" href="wapcategorynew1.asp?cardno=2&MasterCategory=$(MasterCategory)" >

It should look like this:

<go method="post" href="wapcategorynew1.asp?cardno=2&amp;MasterCategory=$(MasterCategory)" >

So in your code replace all & with &amp; if it is in a URL or is being displayed to screen.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

MAC Filtering: MAC filtering is like handing a list of names to a doorman. If someone comes to the door and mentions a name, this name is checked by the doorman on his list and granted or denied access by this. This means that if someone menti…
In this article we have discussed about the OS X EI Capitan and how to fix Wi-Fi issue in OS X El Capitan. We have explained how to delete system level preferences and create a new Wi-Fi location to resolve Wi-Fi issue.
This Micro Tutorial will show you how to maximize your wireless card to its maximum capability. This will be demonstrated using Intel(R) Centrino(R) Wireless-N 2230 wireless card on Windows 8 operating system.
Viewers will learn how to connect to a wireless network using the network security key. They will also learn how to access the IP address and DNS server for connections that must be done manually. After setting up a router, find the network security…
Suggested Courses

872 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