QueryString

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fran7
    New Member
    • Jul 2006
    • 229

    QueryString

    Hi, Trying to solve a problem with no knowledge of asp.

    I have a dropdown list populated from my database with card decription. The output is names like, abstract,illust ration etc.

    I am sending the results to another page like so
    Code:
    .. html
    directory.asp?PostCardID=XX
    ..
    Now the request.queryst ring I presume should be something like this.
    Code:
    ..asp
    <%=request.QueryString("PostcardID")%>
    ..
    But all I get is xx as output.
    When someone selects from the dropdown I am trying to populate the page with all those from the database who have the same title and so am trying to get the ids.

    Is there something more to this, I am sure there is.
    Thanks in advance for any help.

    Basically I was told I had to get the get the PostCardID into the action querystring
    Richard
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    Originally posted by fran7
    Hi, Trying to solve a problem with no knowledge of asp.

    I have a dropdown list populated from my database with card decription. The output is names like, abstract,illust ration etc.

    I am sending the results to another page like so
    Code:
    .. html
    directory.asp?PostCardID=XX
    ..
    Now the request.queryst ring I presume should be something like this.
    Code:
    ..asp
    <%=request.QueryString("PostcardID")%>
    ..
    But all I get is xx as output.
    When someone selects from the dropdown I am trying to populate the page with all those from the database who have the same title and so am trying to get the ids.

    Is there something more to this, I am sure there is.
    Thanks in advance for any help.

    Basically I was told I had to get the get the PostCardID into the action querystring
    Richard

    try the redirect method.

    <%
    response.redire ct "yourtarget.asp ?variable=" & StrValueOfYourV ariable
    %>

    or something like that

    Comment

    • shweta123
      Recognized Expert Contributor
      • Nov 2006
      • 692

      #3
      Hi,

      If you are getting any problem accessing querystring , you can even use Hidden varaibles.
      e.g.

      <Input type ="hidden" name ="PostCardID " value ="value">

      and access this value in target.asp as Request.Form("P ostCard")

      Comment

      • fran7
        New Member
        • Jul 2006
        • 229

        #4
        Thanks for the reply guys,
        Neither idea could I get to work.
        Will bash on.
        Thanks

        Comment

        • jhardman
          Recognized Expert Specialist
          • Jan 2007
          • 3405

          #5
          Originally posted by fran7
          Thanks for the reply guys,
          Neither idea could I get to work.
          Will bash on.
          Thanks
          Wait, are you saying that you are getting the postcardID out of the querystring, but you actually want more data from the database? If that is the case, then on the second page you need to open the db again and look up that info. [code=asp]objRS.open "SELECT * FROM cardTable WHERE postcardID = " & request("postca rdID"), objConn[/code]
          The only information you passed from one page to the other is the postcardID.

          Jared

          Comment

          • ilearneditonline
            Recognized Expert New Member
            • Jul 2007
            • 130

            #6
            Originally posted by fran7
            Thanks for the reply guys,
            Neither idea could I get to work.
            Will bash on.
            Thanks
            From what I can tell, your problem is related to getting the value to the querystring itself.

            Here is the way I normally do it if I only have 1 dropdown, usually for navigation.
            [HTML] <select name="navigate" onChange="windo w.location='dir ectory.asp?Post CardID=' + this.options[this.selectedIn dex].value">[/HTML]

            You could also do this through a javascript function. Or you could put the dropdown in a form and when they push the submit button, it would submit the value.

            [HTML]<form method="get" action="directo ry.asp">
            <select name="PostCardI D">
            <input type="submit" />
            </form>[/HTML]

            Then on the directory.asp you would do like Jared recommended.

            Comment

            • fran7
              New Member
              • Jul 2006
              • 229

              #7
              Hey Guys, Thanks, I really think I am getting somewhere with your help.

              Adding your suggestion to the form I now get the name selected from the dropdown list showing on the next page, ie select abstract art, and abstract art shows up on the target page. Great!

              Code:
              ..asp
              
              <form method="Post">
              <select name="navigate" onChange="window.location='manner.asp?PostCardID=' + this.options[this.selectedIndex].value">
              
              	<%		
              	Set oRs=Server.CreateObject("adodb.recordset")
              	strSQL = "SELECT DISTINCT CardDescription FROM tblGreetingPostCards ORDER BY CardDescription"
              	oRs.Open strSQL, conn		
              		
              	Do while not oRs.EOF
              		if Request.Form("GreetingPostCards") = oRs("CardDescription") then 'if this is the selected one then display as selected
              			Response.Write "<OPTION VALUE = '" & oRS ("CardDescription") & "' SELECTED>"
              			Response.Write oRs("CardDescription") & "</Option>"
              			oRs.MoveNext 
              		else
              			Response.Write "<OPTION VALUE = '" & oRs ("CardDescription") & "'>"
              			Response.Write oRs("CardDescription") & "</Option>"
              			oRs.MoveNext 
              		end if
              	loop		
              	%>
              </SELECT>
                </form>
              ..asp

              And you are spot on, wasnt really explaining well, but I think i probably do need more info from the database. Not sure what is going on exactly, but where exactly would I add the below code.

              Basically I need to populate the page with all those in the database with the headings selected. So I imagine I need to get the ids.


              Code:
              ..asp
              
              objRS.open "SELECT * FROM GreetingPostCards WHERE postcardID = " & request("postcardID"), objConn
              ..asp

              Tha actual page has all this asp at the top. Do I add it there? and do I have to wrap it in anything? or do I add it to the body of the page.

              Code:
              ..asp
              
              
              
              
              
              <!--#Include File="art/dbconnect.asp"-->
              <%
              
              
              '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
              '   Product:  Greeting Card Pro Version 2.1
              '   Author:   AdComplete.com, LLC
              '   Date: January 21, 2002                
              '   (c) Copyright 2000-2002 by AdComplete.com, LLC.  All rights reserved.
              '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
              
              
              lngCategoryID=CLng(Request("CategoryID"))
              If lngCategoryID <> "" And lngCategoryID <> 0 Then
              
              	Set connPostCardSoft=Server.CreateObject("ADODB.Connection") 
              	connPostCardSoft.Open PostCardSoftConnectString
              	Set rsCard=Server.CreateObject("ADODB.Recordset")
              	rsCard.CursorLocation = 3
                  SQLQuery="Select PostCardID,DefaultHeadline,CardDescription,DefaultMessage,Author,ThumbnailURL,AdvancedCard,ThumbnailHTML,Rnd([PostCardID]) From tblGreetingPostCards Where CategoryID=" & Clng(lngCategoryID) & " Order By Rnd([PostCardID])"
                  rsCard.Open SQLQuery, connPostCardSoft
                 	rsCard.PageSize = 200
                 	intPageCount = rsCard.PageCount
              
              	If rsCard.EOF=True Then
              		Response.Write "<p>No cards found in database for this category."
              		Response.End
              	End If
              End If
              
              'search feature
              If Request("SearchWord") <> "" Then
              	strWd=Replace(Request("SearchWord"),"'","''")
              	strSQL="Select PostCardID,DefaultHeadline,CardDescription,DefaultMessage,Author, "
              	strSQL=strSQL & " ThumbnailURL,AdvancedCard,ThumbnailHTML From tblGreetingPostCards Where Keywords Like '%" & strWD & "%' OR "
              	strSQL=strSQL & " DefaultHeadline Like '%" & strWD & "%' OR "
              	strSQL=strSQL & " CardDescription Like '%" & strWD & "%' OR "
              	strSQL=strSQL & " Author Like '%" & strWD & "%' OR "
              	strSQL=strSQL & " DefaultMessage Like '%" & strWD & "%' "
              	
              	Set connPostCardSoft=Server.CreateObject("ADODB.Connection") 
              	connPostCardSoft.Open PostCardSoftConnectString
              	Set rsCard=Server.CreateObject("ADODB.Recordset")
              	rsCard.CursorLocation = 3
              	rsCard.Open strSQL, connPostCardSoft
                 	rsCard.PageSize = 200
                 	intPageCount = rsCard.PageCount
              End If
              
              strAddition="bgcolor=" & Chr(34) & Application("gcp_SearchPageBackgroundColor") & Chr(34)
              strCategoryBarFontColor=Application("gcp_SearchPageFontBarColor")
              strCategoryBarColor=Application("gcp_SearchPageBarColor")
              
              'Retrieve Category Name
              If lngCategoryID <> "" and lngCategoryID <> 0 Then
              	Set rsCat=connPostCardSoft.Execute("Select * From tblGreetingCategories Where CategoryID=" & Clng(lngCategoryID))
              	strCat="" & rsCat("CategoryName")
              
              	If rsCat("CategoryBackgroundImage")<> "" Then
              		strAddition="background=" & Chr(34) & rsCat("CategoryBackgroundImage") & Chr(34)
              	End If
              	If rsCat("CategoryBackgroundColor")<>"" Then
              		strAddition="bgcolor=" & Chr(34) & rsCat("CategoryBackgroundColor") & Chr(34)
              	End If
              	strCategoryBarFontColor=rsCat("CategoryBarFontColor")
              	strCategoryBarColor=rsCat("CategoryBarColor")
              	FontName=rsCat("FontName")
              	FontColor=rsCat("FontColor")
              Else
              	strCat="Search results for:" & strWD
              	FontName=Application("gcp_FontName")
              	FontColor=Application("gcp_FontColor")
              End If
              
              
                 Select Case Request("Action")
                         case "  <<  "
                                 intpage = 1
                         case "  <  "
                                 intpage = Request("intpage")-1
                                 if intpage < 1 then intpage = 1
                         case "  >  "
                                 intpage = Request("intpage")+1
                                 if intpage > intPageCount then intpage = IntPageCount
                         Case "  >>  "
                                 intpage = intPageCount
                         case else
                                 intpage = 1
                                 If Request.QueryString("intpage") <> "" Then
                                 	intpage=Request.QueryString("intpage")
                                 End If
                 end select
              
              
              
              %>
              ..asp


              Thanks a million
              Richard

              Comment

              • ilearneditonline
                Recognized Expert New Member
                • Jul 2007
                • 130

                #8
                Richard,

                I am a bit confused now. I understand what the current code is doing, but I am trying to figure out what you have and what you are actually trying to accomplish.
                The snippet that you referred to that was provided by Jared is only that, a snippet. You would need to write more code to do anything with it. Please be more specific about what you expect to happen that isn't happening now.

                Comment

                • fran7
                  New Member
                  • Jul 2006
                  • 229

                  #9
                  Hi, The page as it stands is below. There is a loop in the table that populates the page with my card links together with popups. I am trying to add a dropdown list to the page with the cardDescription got from the database. What I want is to populate the page with all cards that correspond to each carddescription , so if 50 cards are categorized under abstract, that only those populate the page.

                  Basically trying to get the postcard id into a querystring and to get that to populate the page in the loop.

                  I have the dropdown on another page, although I want it on this page I was not able to get it working with the database connection.

                  So all the cards are in Categories...li ke categoryid=1,2, 3,4,5 etc
                  then each has a card description cardDescription like "abstract","ill ustration" etc.

                  So it is to get the card associated with each card description to populate the page and I think that has to be done with the card ID.


                  Code:
                  .. ASP
                  
                  
                  <!--#Include File="art/dbconnect.asp"-->
                  <%
                  
                  
                  '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
                  '   Product:  Greeting Card Pro Version 2.1
                  '   Author:   AdComplete.com, LLC
                  '   Date: January 21, 2002                
                  '   (c) Copyright 2000-2002 by AdComplete.com, LLC.  All rights reserved.
                  '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
                  
                  
                  lngCategoryID=CLng(Request("CategoryID"))
                  If lngCategoryID <> "" And lngCategoryID <> 0 Then
                  
                  	Set connPostCardSoft=Server.CreateObject("ADODB.Connection") 
                  	connPostCardSoft.Open PostCardSoftConnectString
                  	Set rsCard=Server.CreateObject("ADODB.Recordset")
                  	rsCard.CursorLocation = 3
                      SQLQuery="Select PostCardID,DefaultHeadline,CardDescription,DefaultMessage,Author,ThumbnailURL,AdvancedCard,ThumbnailHTML,Rnd([PostCardID]) From tblGreetingPostCards Where CategoryID=" & Clng(lngCategoryID) & " Order By Rnd([PostCardID])"
                      rsCard.Open SQLQuery, connPostCardSoft
                     	rsCard.PageSize = 200
                     	intPageCount = rsCard.PageCount
                  
                  	If rsCard.EOF=True Then
                  		Response.Write "<p>No cards found in database for this category."
                  		Response.End
                  	End If
                  End If
                  
                  'search feature
                  If Request("SearchWord") <> "" Then
                  	strWd=Replace(Request("SearchWord"),"'","''")
                  	strSQL="Select PostCardID,DefaultHeadline,CardDescription,DefaultMessage,Author, "
                  	strSQL=strSQL & " ThumbnailURL,AdvancedCard,ThumbnailHTML From tblGreetingPostCards Where Keywords Like '%" & strWD & "%' OR "
                  	strSQL=strSQL & " DefaultHeadline Like '%" & strWD & "%' OR "
                  	strSQL=strSQL & " CardDescription Like '%" & strWD & "%' OR "
                  	strSQL=strSQL & " Author Like '%" & strWD & "%' OR "
                  	strSQL=strSQL & " DefaultMessage Like '%" & strWD & "%' "
                  	
                  	Set connPostCardSoft=Server.CreateObject("ADODB.Connection") 
                  	connPostCardSoft.Open PostCardSoftConnectString
                  	Set rsCard=Server.CreateObject("ADODB.Recordset")
                  	rsCard.CursorLocation = 3
                  	rsCard.Open strSQL, connPostCardSoft
                     	rsCard.PageSize = 200
                     	intPageCount = rsCard.PageCount
                  End If
                  
                  strAddition="bgcolor=" & Chr(34) & Application("gcp_SearchPageBackgroundColor") & Chr(34)
                  strCategoryBarFontColor=Application("gcp_SearchPageFontBarColor")
                  strCategoryBarColor=Application("gcp_SearchPageBarColor")
                  
                  'Retrieve Category Name
                  If lngCategoryID <> "" and lngCategoryID <> 0 Then
                  	Set rsCat=connPostCardSoft.Execute("Select * From tblGreetingCategories Where CategoryID=" & Clng(lngCategoryID))
                  	strCat="" & rsCat("CategoryName")
                  
                  	If rsCat("CategoryBackgroundImage")<> "" Then
                  		strAddition="background=" & Chr(34) & rsCat("CategoryBackgroundImage") & Chr(34)
                  	End If
                  	If rsCat("CategoryBackgroundColor")<>"" Then
                  		strAddition="bgcolor=" & Chr(34) & rsCat("CategoryBackgroundColor") & Chr(34)
                  	End If
                  	strCategoryBarFontColor=rsCat("CategoryBarFontColor")
                  	strCategoryBarColor=rsCat("CategoryBarColor")
                  	FontName=rsCat("FontName")
                  	FontColor=rsCat("FontColor")
                  Else
                  	strCat="Search results for:" & strWD
                  	FontName=Application("gcp_FontName")
                  	FontColor=Application("gcp_FontColor")
                  End If
                  
                  
                     Select Case Request("Action")
                             case "  <<  "
                                     intpage = 1
                             case "  <  "
                                     intpage = Request("intpage")-1
                                     if intpage < 1 then intpage = 1
                             case "  >  "
                                     intpage = Request("intpage")+1
                                     if intpage > intPageCount then intpage = IntPageCount
                             Case "  >>  "
                                     intpage = intPageCount
                             case else
                                     intpage = 1
                                     If Request.QueryString("intpage") <> "" Then
                                     	intpage=Request.QueryString("intpage")
                                     End If
                     end select
                  
                  
                  
                  %>
                  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
                  <html>
                  
                  
                  <head>
                  <title><%=strCat%></title>
                  <meta name="description" content="art directory,painting,abstract,ceramics and ecards of quality contemporary artists.">
                  <meta http-equiv="cache-control" content="no-cache">
                  <meta http-equiv="pragma" content="no-cache">
                  <link rel="stylesheet" type="text/css" href="css/newwotartist.css">
                  <META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
                  <meta name="GENERATOR" content="Microsoft FrontPage 6.0">
                  <meta name="ProgId" content="FrontPage.Editor.Document">
                  <script src="/js/dw_event.js" type="text/javascript"></script>
                  <script src="/js/dw_tooltip.js" type="text/javascript"></script>
                  <script src="/js/dw_viewport.js" type="text/javascript"></script>
                  <script language="javascript">
                  <!--
                  
                  function dept_onchange(frmSelect) {
                  	frmSelect.submit(); 
                  }
                  
                  //-->
                  </script>
                  
                  <style type="text/css">
                  form.test {background: transparent;border-color: #000;padding-left:0px;padding-top:20px;font-size: 10px;}
                  select {width:100%;background-color:#303030;font-size: 10px;color:silver;}
                  option{background-color:#303030;  font-size: 10px; color:silver;}
                   
                  .texta { 
                   font-size: 14px; 
                   background-color: #c0c0c0; 
                   border: 1px solid #808080;
                   
                  width: 110px;
                  height: 18px;
                  }
                  #fixedtipdiv
                  {
                  position:absolute;
                  padding: 2px;
                  border:1px solid black;
                  font:normal 12px Verdana;
                  line-height:18px;
                  z-index:100;
                  }
                  div#tipDiv {
                    position:absolute; visibility:hidden; left:0; top:0; z-index:10000;
                    background-color:#efefef; border:1px solid #000; 
                    width:180px; padding:6px;
                    color:#000; font-size:11px; line-height:1.3;
                  }
                  /* These are used in the wrapTipContent function */
                  div#tipDiv div.img { text-align:center }
                  div#tipDiv div.txt { text-align:center; margin-top:4px }
                  .silver{color:silver}
                  </style>
                  
                  </head>
                  
                  <body <%=strAddition%> text="<%=FontColor%>" link="<%=FontColor%>" vlink="<%=FontColor%>" alink="<%=FontColor%>">
                  <%=Application("gcp_HeaderHTML")%>
                  <div id="container">
                  <div id="outer">
                  <div id="topgap"></div>
                  <div id="contentt">
                  <div id="leftlogo"><div id="relative">
                  <img class="logo"  border="0" src="/images2/wotartist1.jpg"  alt="wotecard" title="wotecard" width="378" height="57">
                  </div></div>
                  <div id="greybox">
                  <ul id="navlist">
                  <li><span class="large"><a class="men"href="/directory.asp?categoryid=1" title="AMERICAS">AMERICAS</a></span></li>
                  <li><span class="large"><a class="men"href="/directory.asp?categoryid=2" title="UK">UK</a></span></li>
                  <li><span class="large"><a class="men"href="/directory.asp?categoryid=4" title="EUROPE">EUROPE</a></span></li>
                  <li><span class="large"><a class="men"href="/directory.asp?categoryid=3" title="AUSTRALIA">AUSTRALIA</a></span></li>
                  <li><span class="large"><a class="men"href="/directory.asp?categoryid=5" title="Asia & middle east">ASIA/MIDDLE EAST</a></span></li>
                  <li><span class="large"><a class="mena" href="/submit.asp" title="SUBMIT">submit</a></span></li>
                  <li><span class="large"><a class="mena" href="/submit.asp#a1" title="DONATE">donate</a></span></li>
                  <li><span class="large"><a class="mena" href="/websitedesign.asp" title="DESIGN"home>design</a></span></li>
                  <li><span class="large"><a class="mena" href="./" title="home">home</a></span></li>
                  </ul>
                  
                    <tr>
                                 <td width="545">
                                        <div style="height:25px;"></div>
                                          <form method="POST" action="directory.asp" onsubmit="return FrontPage_Form1_Validator(this)" name="FrontPage_Form1" language="JavaScript">
                                            <p align="left"><font face="Arial" size="2"></font>
                  							<!--webbot bot="Validation" s-display-name="Search Word" b-value-required="TRUE" i-minimum-length="1" --><input type="text" class="texta" name="SearchWord" size="13">&nbsp;&nbsp;
                                            <input type="image" SRC="art/images/button.gif" style="vertical-align:top;"value="Search" name="B1" width="60" height="22"></p>
                                          </form>
                                        </td>
                                      </tr>
                  </div>
                  <div style="clear:both;"></div>
                  
                  <div id="websites">
                  <p></p> 
                  
                    [B]<%=request.QueryString("PostcardID")%> [/B] 
                    
                  
                  <table width="100%">
                  
                  
                  
                  	<%   
                  	If Not rsCard.EOF Then
                  	rsCard.AbsolutePage = intPage 
                   
                  
                     For intRecord = 1 To rsCard.PageSize
                  	CurrentColumn=1
                  %>
                  <tr>     
                  
                  <%
                  	Do While CurrentColumn<=5   
                  %>
                  		<td><br><font size="2"><p></p>  
                  <a onmouseover="doTooltip(event,'<img src=&quot;<%=Server.URLPathEncode(rsCard("ThumbnailURL"))%>&quot; alt=&quot;&quot; border=&quot;0&quot;><div class=&quot;tp2&quot;><%If Trim(rsCard("Author"))<>"" Then%> <%=rsCard("Author")%><%End If%></div>' )" onmouseout="hideTip()" href="http://<%=rsCard("DefaultHeadline")%>" target="_blank"><%=rsCard("CardDescription")%></a>
                                  </font>
                                  
                    <p align="left"><font size="1"><span style="color : #303030;"><%If Trim(rsCard("Author"))<>"" Then%> <%=rsCard("Author")%><%End If%></font></span>
                  		<p align="left"><font face="<%=FontName%>" size="1"><a href="card.asp?PostCardID=<%=rsCard("PostCardID")%>">
                        <I><%=rsCard("DefaultMessage")%></I><a>
                                  
                                  
                                  </td>
                  <%
                  
                  		CurrentColumn=CurrentColumn+1
                  		rsCard.MoveNext
                  		If rsCard.EOF Then Exit For 
                  	Loop
                  %>
                  </tr>
                  
                  <%
                  
                  
                     intRecord =intRecord +1
                  
                  Next  
                  End If
                  %>
                  		
                  	</tr>
                  	<tr>
                  		<td colspan="5"><%If intpagecount > 1 Then %>
                  <font face="<%=FontName%>" size="1"><form name="MovePage" action="directory.asp?CategoryID=<%=lngCategoryID%>" method="post">
                        <input type="hidden" name="intpage" value="<%=intpage%>"><input type="hidden" name="SearchWord" value="<%=strWd%>"><div align="center"><center><p><br><input
                        type="submit" name="action" value="  &lt;&lt;  "> <input type="submit" name="action"
                        value="  &lt;  "> <input type="submit" name="action" value="  &gt;  "> <input type="submit"
                        name="action" value="  &gt;&gt;  "><br>
                  Page: <%=Intpage & " of " & intpagecount%> <br>
                          </font></p>
                       
                      </form>
                  <% End If %></td>
                  	</tr>
                  	<tr>
                  	<td colspan="5"><br><br><br><br><p><font face="Arial" align="left" size="2"><br><font face="Arial" size="1">
                                        <b>Important Copyright Notice!</b>&nbsp;&nbsp;The copyright of all images on this site is property of the respective artists. Any use or reproduction of the 
                                        content without prior written permission of the artist is strictly forbidden. 
                  </font></p></td></tr>
                  	
                  </table>
                  <%=Application("gcp_FooterHTML")%>
                  
                  
                  
                  </div>
                  <div style="clear:both;"> </div>
                  
                  </div>
                  <div id="footer" ></div>
                  </div></div>
                  </body>
                  </html>
                  <% connPostCardSoft.Close()
                  Set connPostCardSoft=Nothing
                  Set rsCard=Nothing
                  Set rsCat=Nothing
                  %>
                  ..ASP


                  the dropdown I got working on another page is


                  Code:
                  ..asp
                  
                  
                  
                  <%@ Language=VBScript %>
                  <%Option explicit
                  Dim oRs, conn, connect, strSQL
                  
                  set conn=server.CreateObject ("adodb.connection")
                  connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("/fpdb/greetingcardpro.mdb") & ";Persist Security Info=False"
                  conn.Open connect
                  
                  %>
                  
                  <html><head><title></title>
                  
                  <script language="javascript">
                  <!--
                  
                  function dept_onchange(frmSelect) {
                  	frmSelect.submit(); 
                  }
                  
                  //-->
                  </script>
                  
                  </head>
                  <body>
                  <div id="menu">
                  <form method="Post">
                  <select name="navigate" onChange="window.location='manner.asp?PostCardID=' + this.options[this.selectedIndex].value">
                  
                  	<%		
                  	Set oRs=Server.CreateObject("adodb.recordset")
                  	strSQL = "SELECT DISTINCT CardDescription FROM tblGreetingPostCards ORDER BY CardDescription"
                  	oRs.Open strSQL, conn		
                  		
                  	Do while not oRs.EOF
                  		if Request.Form("GreetingPostCards") = oRs("CardDescription") then 'if this is the selected one then display as selected
                  			Response.Write "<OPTION VALUE = '" & oRS ("CardDescription") & "' SELECTED>"
                  			Response.Write oRs("CardDescription") & "</Option>"
                  			oRs.MoveNext 
                  		else
                  			Response.Write "<OPTION VALUE = '" & oRs ("CardDescription") & "'>"
                  			Response.Write oRs("CardDescription") & "</Option>"
                  			oRs.MoveNext 
                  		end if
                  	loop		
                  	%>
                  </SELECT>
                    </form>
                  </div>
                  </body>
                  </html>
                  ..asp



                  I dont know if that makes sence.
                  Thanks again
                  Richard
                  Last edited by fran7; Aug 7 '07, 12:19 AM. Reason: none

                  Comment

                  • fran7
                    New Member
                    • Jul 2006
                    • 229

                    #10
                    Hi, The page as it stands is below. There is a loop in the table that populates the page with my card links together with popups. I am trying to add a dropdown list to the page with the cardDescription got from the database. What I want is to populate the page with all cards that correspond to each carddescription , so if 50 cards are categorized under abstract, that only those populate the page.

                    Basically trying to get the postcard id into a querystring and to get that to populate the page in the loop.

                    I have the dropdown on another page, although I want it on this page I was not able to get it working with the database connection.

                    So all the cards are in Categories...li ke categoryid=1,2, 3,4,5 etc
                    then each has a card description cardDescription like "abstract","ill ustration" etc.

                    So it is to get the card associated with each card description to populate the page and I think that has to be done by associating each postcard ID with names in the carddescription . Maybe one should send the carddescription instead of id and in the query string, write if cardescription then cardID


                    Code:
                    .. ASP
                    
                    
                    <!--#Include File="art/dbconnect.asp"-->
                    <%
                    
                    
                    
                    lngCategoryID=CLng(Request("CategoryID"))
                    If lngCategoryID <> "" And lngCategoryID <> 0 Then
                    
                    	Set connPostCardSoft=Server.CreateObject("ADODB.Connection") 
                    	connPostCardSoft.Open PostCardSoftConnectString
                    	Set rsCard=Server.CreateObject("ADODB.Recordset")
                    	rsCard.CursorLocation = 3
                        SQLQuery="Select PostCardID,DefaultHeadline,CardDescription,DefaultMessage,Author,ThumbnailURL,AdvancedCard,ThumbnailHTML,Rnd([PostCardID]) From tblGreetingPostCards Where CategoryID=" & Clng(lngCategoryID) & " Order By Rnd([PostCardID])"
                        rsCard.Open SQLQuery, connPostCardSoft
                       	rsCard.PageSize = 200
                       	intPageCount = rsCard.PageCount
                    
                    	If rsCard.EOF=True Then
                    		Response.Write "<p>No cards found in database for this category."
                    		Response.End
                    	End If
                    End If
                    
                    'search feature
                    If Request("SearchWord") <> "" Then
                    	strWd=Replace(Request("SearchWord"),"'","''")
                    	strSQL="Select PostCardID,DefaultHeadline,CardDescription,DefaultMessage,Author, "
                    	strSQL=strSQL & " ThumbnailURL,AdvancedCard,ThumbnailHTML From tblGreetingPostCards Where Keywords Like '%" & strWD & "%' OR "
                    	strSQL=strSQL & " DefaultHeadline Like '%" & strWD & "%' OR "
                    	strSQL=strSQL & " CardDescription Like '%" & strWD & "%' OR "
                    	strSQL=strSQL & " Author Like '%" & strWD & "%' OR "
                    	strSQL=strSQL & " DefaultMessage Like '%" & strWD & "%' "
                    	
                    	Set connPostCardSoft=Server.CreateObject("ADODB.Connection") 
                    	connPostCardSoft.Open PostCardSoftConnectString
                    	Set rsCard=Server.CreateObject("ADODB.Recordset")
                    	rsCard.CursorLocation = 3
                    	rsCard.Open strSQL, connPostCardSoft
                       	rsCard.PageSize = 200
                       	intPageCount = rsCard.PageCount
                    End If
                    
                    strAddition="bgcolor=" & Chr(34) & Application("gcp_SearchPageBackgroundColor") & Chr(34)
                    strCategoryBarFontColor=Application("gcp_SearchPageFontBarColor")
                    strCategoryBarColor=Application("gcp_SearchPageBarColor")
                    
                    'Retrieve Category Name
                    If lngCategoryID <> "" and lngCategoryID <> 0 Then
                    	Set rsCat=connPostCardSoft.Execute("Select * From tblGreetingCategories Where CategoryID=" & Clng(lngCategoryID))
                    	strCat="" & rsCat("CategoryName")
                    
                    	If rsCat("CategoryBackgroundImage")<> "" Then
                    		strAddition="background=" & Chr(34) & rsCat("CategoryBackgroundImage") & Chr(34)
                    	End If
                    	If rsCat("CategoryBackgroundColor")<>"" Then
                    		strAddition="bgcolor=" & Chr(34) & rsCat("CategoryBackgroundColor") & Chr(34)
                    	End If
                    	strCategoryBarFontColor=rsCat("CategoryBarFontColor")
                    	strCategoryBarColor=rsCat("CategoryBarColor")
                    	FontName=rsCat("FontName")
                    	FontColor=rsCat("FontColor")
                    Else
                    	strCat="Search results for:" & strWD
                    	FontName=Application("gcp_FontName")
                    	FontColor=Application("gcp_FontColor")
                    End If
                    
                    
                       Select Case Request("Action")
                               case "  <<  "
                                       intpage = 1
                               case "  <  "
                                       intpage = Request("intpage")-1
                                       if intpage < 1 then intpage = 1
                               case "  >  "
                                       intpage = Request("intpage")+1
                                       if intpage > intPageCount then intpage = IntPageCount
                               Case "  >>  "
                                       intpage = intPageCount
                               case else
                                       intpage = 1
                                       If Request.QueryString("intpage") <> "" Then
                                       	intpage=Request.QueryString("intpage")
                                       End If
                       end select
                    
                    
                    
                    %>
                    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
                    <html>
                    
                    
                    <head>
                    <title><%=strCat%></title>
                    <meta name="description" content="art directory,painting,abstract,ceramics and ecards of quality contemporary artists.">
                    <meta http-equiv="cache-control" content="no-cache">
                    <meta http-equiv="pragma" content="no-cache">
                    <link rel="stylesheet" type="text/css" href="css/newwotartist.css">
                    <META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
                    <meta name="GENERATOR" content="Microsoft FrontPage 6.0">
                    <meta name="ProgId" content="FrontPage.Editor.Document">
                    <script src="/js/dw_event.js" type="text/javascript"></script>
                    <script src="/js/dw_tooltip.js" type="text/javascript"></script>
                    <script src="/js/dw_viewport.js" type="text/javascript"></script>
                    <script language="javascript">
                    <!--
                    
                    function dept_onchange(frmSelect) {
                    	frmSelect.submit(); 
                    }
                    
                    //-->
                    </script>
                    
                    <style type="text/css">
                    form.test {background: transparent;border-color: #000;padding-left:0px;padding-top:20px;font-size: 10px;}
                    select {width:100%;background-color:#303030;font-size: 10px;color:silver;}
                    option{background-color:#303030;  font-size: 10px; color:silver;}
                     
                    .texta { 
                     font-size: 14px; 
                     background-color: #c0c0c0; 
                     border: 1px solid #808080;
                     
                    width: 110px;
                    height: 18px;
                    }
                    #fixedtipdiv
                    {
                    position:absolute;
                    padding: 2px;
                    border:1px solid black;
                    font:normal 12px Verdana;
                    line-height:18px;
                    z-index:100;
                    }
                    div#tipDiv {
                      position:absolute; visibility:hidden; left:0; top:0; z-index:10000;
                      background-color:#efefef; border:1px solid #000; 
                      width:180px; padding:6px;
                      color:#000; font-size:11px; line-height:1.3;
                    }
                    /* These are used in the wrapTipContent function */
                    div#tipDiv div.img { text-align:center }
                    div#tipDiv div.txt { text-align:center; margin-top:4px }
                    .silver{color:silver}
                    </style>
                    
                    </head>
                    
                    <body <%=strAddition%> text="<%=FontColor%>" link="<%=FontColor%>" vlink="<%=FontColor%>" alink="<%=FontColor%>">
                    <%=Application("gcp_HeaderHTML")%>
                    <div id="container">
                    <div id="outer">
                    <div id="topgap"></div>
                    <div id="contentt">
                    <div id="leftlogo"><div id="relative">
                    <img class="logo"  border="0" src="/images2/.jpg"  alt="" title="" width="378" height="57">
                    </div></div>
                    <div id="greybox">
                    <ul id="navlist">
                    
                    </ul>
                    
                      <tr>
                                   <td width="545">
                                          <div style="height:25px;"></div>
                                            <form method="POST" action="directory.asp" onsubmit="return FrontPage_Form1_Validator(this)" name="FrontPage_Form1" language="JavaScript">
                                              <p align="left"><font face="Arial" size="2"></font>
                    							<!--webbot bot="Validation" s-display-name="Search Word" b-value-required="TRUE" i-minimum-length="1" --><input type="text" class="texta" name="SearchWord" size="13">&nbsp;&nbsp;
                                              <input type="image" SRC="art/images/button.gif" style="vertical-align:top;"value="Search" name="B1" width="60" height="22"></p>
                                            </form>
                                          </td>
                                        </tr>
                    </div>
                    <div style="clear:both;"></div>
                    
                    <div id="websites">
                    <p></p> 
                    
                      [B]<%=request.QueryString("PostcardID")%> [/B] 
                      
                    
                    <table width="100%">
                    
                    
                    
                    	<%   
                    	If Not rsCard.EOF Then
                    	rsCard.AbsolutePage = intPage 
                     
                    
                       For intRecord = 1 To rsCard.PageSize
                    	CurrentColumn=1
                    %>
                    <tr>     
                    
                    <%
                    	Do While CurrentColumn<=5   
                    %>
                    		<td><br><font size="2"><p></p>  
                    <a onmouseover="doTooltip(event,'<img src=&quot;<%=Server.URLPathEncode(rsCard("ThumbnailURL"))%>&quot; alt=&quot;&quot; border=&quot;0&quot;><div class=&quot;tp2&quot;><%If Trim(rsCard("Author"))<>"" Then%> <%=rsCard("Author")%><%End If%></div>' )" onmouseout="hideTip()" href="http://<%=rsCard("DefaultHeadline")%>" target="_blank"><%=rsCard("CardDescription")%></a>
                                    </font>
                                    
                      <p align="left"><font size="1"><span style="color : #303030;"><%If Trim(rsCard("Author"))<>"" Then%> <%=rsCard("Author")%><%End If%></font></span>
                    		<p align="left"><font face="<%=FontName%>" size="1"><a href="card.asp?PostCardID=<%=rsCard("PostCardID")%>">
                          <I><%=rsCard("DefaultMessage")%></I><a>
                                    
                                    
                                    </td>
                    <%
                    
                    		CurrentColumn=CurrentColumn+1
                    		rsCard.MoveNext
                    		If rsCard.EOF Then Exit For 
                    	Loop
                    %>
                    </tr>
                    
                    <%
                    
                    
                       intRecord =intRecord +1
                    
                    Next  
                    End If
                    %>
                    		
                    	</tr>
                    	<tr>
                    		<td colspan="5"><%If intpagecount > 1 Then %>
                    <font face="<%=FontName%>" size="1"><form name="MovePage" action="directory.asp?CategoryID=<%=lngCategoryID%>" method="post">
                          <input type="hidden" name="intpage" value="<%=intpage%>"><input type="hidden" name="SearchWord" value="<%=strWd%>"><div align="center"><center><p><br><input
                          type="submit" name="action" value="  &lt;&lt;  "> <input type="submit" name="action"
                          value="  &lt;  "> <input type="submit" name="action" value="  &gt;  "> <input type="submit"
                          name="action" value="  &gt;&gt;  "><br>
                    Page: <%=Intpage & " of " & intpagecount%> <br>
                            </font></p>
                         
                        </form>
                    <% End If %></td>
                    	</tr>
                    	<tr>
                    	<td colspan="5"><br><br><br><br><p><font face="Arial" align="left" size="2"><br><font face="Arial" size="1">
                                          <b>. 
                    </font></p></td></tr>
                    	
                    </table>
                    <%=Application("gcp_FooterHTML")%>
                    
                    
                    
                    </div>
                    <div style="clear:both;"> </div>
                    
                    </div>
                    <div id="footer" ></div>
                    </div></div>
                    </body>
                    </html>
                    <% connPostCardSoft.Close()
                    Set connPostCardSoft=Nothing
                    Set rsCard=Nothing
                    Set rsCat=Nothing
                    %>
                    ..ASP









                    the dropdown I got working on another page is







                    Code:
                    ..asp
                    
                    
                    
                    <%@ Language=VBScript %>
                    <%Option explicit
                    Dim oRs, conn, connect, strSQL
                    
                    set conn=server.CreateObject ("adodb.connection")
                    connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("/fpdb/greetingcardpro.mdb") & ";Persist Security Info=False"
                    conn.Open connect
                    
                    %>
                    
                    <html><head><title></title>
                    
                    <script language="javascript">
                    <!--
                    
                    function dept_onchange(frmSelect) {
                    	frmSelect.submit(); 
                    }
                    
                    //-->
                    </script>
                    
                    </head>
                    <body>
                    <div id="menu">
                    <form method="Post">
                    <select name="navigate" onChange="window.location='manner.asp?PostCardID=' + this.options[this.selectedIndex].value">
                    
                    	<%		
                    	Set oRs=Server.CreateObject("adodb.recordset")
                    	strSQL = "SELECT DISTINCT CardDescription FROM tblGreetingPostCards ORDER BY CardDescription"
                    	oRs.Open strSQL, conn		
                    		
                    	Do while not oRs.EOF
                    		if Request.Form("GreetingPostCards") = oRs("CardDescription") then 'if this is the selected one then display as selected
                    			Response.Write "<OPTION VALUE = '" & oRS ("CardDescription") & "' SELECTED>"
                    			Response.Write oRs("CardDescription") & "</Option>"
                    			oRs.MoveNext 
                    		else
                    			Response.Write "<OPTION VALUE = '" & oRs ("CardDescription") & "'>"
                    			Response.Write oRs("CardDescription") & "</Option>"
                    			oRs.MoveNext 
                    		end if
                    	loop		
                    	%>
                    </SELECT>
                      </form>
                    </div>
                    </body>
                    </html>
                    ..asp



                    I dont know if that makes sence. I dont know if it can be done either. Maybe I have to get a dropdown thats linked with the same database link on the main page. That I havent been able to do so I linked from a seperate page, albeit with a different connection, still to the same database. Dont know if thats important.

                    probably confussed you even more.
                    Thanks again for your help
                    Richard

                    Comment

                    • jhardman
                      Recognized Expert Specialist
                      • Jan 2007
                      • 3405

                      #11
                      Richard,

                      Wait, let's see if I understand. There is one dropdown list that allows the user to select a category of postcard. You have this selection submitted to a second page where you want to display a dropdown list of all of the cards in that category. Please confirm that this is right.

                      I'm still not sure what part is giving you trouble. You got the first page to give you a dropdown list, right? Are you still not getting the second page to give you a list of the cards in that category?

                      Jared

                      Comment

                      • fran7
                        New Member
                        • Jul 2006
                        • 229

                        #12
                        Dear Jared, thanks for the reply. Not quite right.
                        I have a dropdown on one page populated with the carddescription s from the database. I want to send the submitted selection to the next page to display in the table like other links display, not in another dropdown list. At the moment if you select abstract, what displays on the next page is simply the word abstract and not the sites that are listed in my database under that carddescription .

                        I need carddescription in the dropdown as they are the headings like abstract etc and I was led to believe that I needed to send the id to the next page to display the relevant sites.

                        So basically I need to send the id relevant to the selection, but when I tried that
                        with asp?cardID=xx, I just got xx appearing in the next page.

                        I dont know if that helps you to understand. I am stabbing in the dark trying to figure this out. basically if you visited wotartist .com you would see what I need to appear.

                        Thanks
                        Richard

                        Comment

                        • jhardman
                          Recognized Expert Specialist
                          • Jan 2007
                          • 3405

                          #13
                          Originally posted by fran7
                          I have a dropdown on one page populated with the carddescription s from the database. I want to send the submitted selection to the next page to display in the table like other links display, not in another dropdown list. At the moment if you select abstract, what displays on the next page is simply the word abstract and not the sites that are listed in my database under that carddescription .
                          OK, not a big difference, I think I get you. maybe. The first page gets categories in a drop down select and the second displays a table with links to each of the art in that category. It looks like you have a good start, though. The first page already gives you a list of categories and the second page checks to make sure it was sent data (the response.write request.queryst ring line only checks to see if data was sent). The second page also opens the database, as I looked over the code. Does it not display anything from the database, or is it displaying stuff from the db that you didn't select? I couldn't tell. It looks to me like when the second page opens the db you want it to say this:[code=asp]
                          strSQL = "SELECT * FROM tblGreetingPost Cards WHERE CardDescription = '" & request.queryst ring("PostCardI D") & "' ORDER BY Rnd([PostCardID])"
                          oRs.Open strSQL, conn 'this opens everything from the db that has
                          'CardDescriptio n = the data sent from the first page. Then you need to put
                          'each link you get into a table

                          response.write "<table><tr >"
                          dim x

                          x = 0

                          Do while not oRs.EOF
                          x = x + 1
                          if x = 5 then
                          response.write "</tr><tr>" 'start a new row every five records
                          x = 0
                          end if

                          'I just pulled the content of the table cell from you code example %>
                          <td><br><font size="2"><p></p>
                          <a onmouseover="do Tooltip(event,' <img
                          src="<%=Server. URLPathEncode(r sCard("Thumbnai lURL"))%>" alt=""
                          border="0"><div class="tp2">
                          <%
                          If Trim(rsCard("Au thor"))<>"" Then %>
                          <%=rsCard("Auth or")%>
                          <%
                          End If %>
                          </div>' )"
                          onmouseout="hid eTip()"
                          href="http://<%=rsCard("Defa ultHeadline")%> "
                          target="_blank" ><%=rsCard("Car dDescription")% ></a>
                          </font>
                          <p align="left"><f ont size="1"><span style="color : #303030;">
                          <%
                          If Trim(rsCard("Au thor"))<>"" Then %>
                          <%=rsCard("Auth or")%>
                          <%
                          End If %>
                          </font></span>
                          <p align="left"><f ont face="<%=FontNa me%>" size="1"><a
                          href="card.asp? PostCardID=<%=r sCard("PostCard ID")%>">
                          <I><%=rsCard("D efaultMessage") %></I><a></td>
                          <%
                          oRs.MoveNext
                          loop
                          response.write "</tr></table>"[/code]

                          I need carddescription in the dropdown as they are the headings like abstract etc and I was led to believe that I needed to send the id to the next page to display the relevant sites.

                          So basically I need to send the id relevant to the selection, but when I tried that
                          with asp?cardID=xx, I just got xx appearing in the next page.
                          right, you need to send the thing the user selected in the first page to the second page, but all they actually selected is a card ID. You need to connect to the db again to see what the card ID means, ie "SELECT * FROM myTable WHERE cardID = " & request("dardID "). Does this make sense?

                          I dont know if that helps you to understand. I am stabbing in the dark trying to figure this out. basically if you visited wotartist .com you would see what I need to appear.
                          I checked out wotartist.com and I think I'm more confused than when I started. Is that supposed to be an example of how it is supposed to work, or is it a work in progress? I definitely don't see the problem you are describing. Is your script page in testing up at a URL where we can check it out?

                          Jared

                          Comment

                          • fran7
                            New Member
                            • Jul 2006
                            • 229

                            #14
                            Dear Jared, I have to thank you for your help.

                            www.wotartist. com/right.asp

                            is where I have the dropdown test popluated from the database. You will see when taken to the next test page, that you just get one carddescription shown. What I am trying to get happening is what happens when you search for a word or use the main country categories, that the page is populated with the relevant links to the category selected from the dropdown.

                            If you look at any country category on the site you will see that artists have a heading, eg, watercolor, abstract etc. It is those that I want to only appear when someone selects from the dropdown.
                            Thanks
                            Richard

                            Comment

                            • jhardman
                              Recognized Expert Specialist
                              • Jan 2007
                              • 3405

                              #15
                              a Ha! The problem is that you have an error on line 229. Which is line 229? it's one of these:[code=asp]<%
                              If Not rsCard.EOF Then
                              rsCard.Absolute Page = intPage


                              For intRecord = 1 To rsCard.PageSize
                              CurrentColumn=1
                              %>[/code] There is some object definition missing, and this is always a tricky problem to find.

                              I notice the page is set up to either return search results or display results from a category. You have never tested it with search results though, right?

                              Jared

                              Comment

                              Working...