SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Addict
    Join Date
    Aug 2003
    Location
    IL
    Posts
    292
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    need a 2nd pair of eyes. my link isnt coming our right

    My code is posing a problem. I want the link to come out as search_results.asp?s1=Issue&s1t=Cancelled
    but instead its coming out as
    search_results.asp?s1= &s1t=Cancelled

    I can't figure out why all of a sudden my variable s1 doesnt have a value once I hit the submit button. Here's my long extensive code. The important bits are the part where I response.write the s1 and s2 and s3 values, they show up on the first page but when I hit the submit button for some reason, they have no value anymore.
    Code:
    <%
    OPTION EXPLICIT 
    ' set up variables
    dim CTDB
    dim DB_select_sub
    dim myRS
    dim selection_1_value
    dim selection_2_value
    dim selection_3_value
    ' connect to the database
    Set CTDB=Server.CreateObject("ADODB.Connection")
    CTDB.ConnectionTimeout=60
    CTDB.Open "DSN=international_hotlines"
    ' collect all the info from the database according to the incrementing_number column in the db
    DB_select_sub="SELECT * FROM hotlines"
    'Response.Write DB_select_sub
    'Response.End
    Set myRS=CTDB.Execute(DB_select_sub)
    'conditional that displays input text box if s1 has value
    dim s1,s2,s3
    If Request("s1")="Supplier Code" Then
      s1="Supplier Code"
      selection_1_value="Supplier Code<br><input type='text' name='selection_1_text' value=''>"
     Else
     If Request("s1")="Part Number" Then
      s1="Part Number"
      selection_1_value="Part Number<br><input type='text' name='selection_1_text' value=''>"
      Else
      If Request("s1")="Customer Service Hotline" Then
       s1="Customer Service Hotline"
       selection_1_value="Customer Service Hotline<br><SELECT NAME='selection_1_text'><OPTION VALUE=''></OPTION><OPTION VALUE='Yes'>Yes</OPTION><OPTION VALUE='No'>No</OPTION></SELECT>"
       Else   
       If Request("s1")="Manual Packing List" Then
    	s1="Manual Packing List"
    	selection_1_value="Manual Packing List<br><SELECT NAME='selection_1_text'><OPTION VALUE=''></OPTION><OPTION VALUE='Yes'>Yes</OPTION><OPTION VALUE='No'>No</OPTION></SELECT>"
    	Else   
    	If Request("s1")="Issue" Then
    	 s1="Issue"
    	 selection_1_value="Issue<br><SELECT NAME='selection_1_text'><OPTION VALUE=''></OPTION><OPTION VALUE='No Manual Packing List'>No Manual Packing List</OPTION><OPTION VALUE='No P.O. Number On Packing List'>No P.O. Number On Packing List</OPTION><OPTION VALUE='No Packing List'>No Packing List</OPTION><OPTION VALUE='No Part Number'>No Part Number</OPTION><OPTION VALUE='Invalid Intl Part Number'>Invalid Intl Part Number</OPTION><OPTION VALUE='Supplier Part Number'>Supplier Part Number</OPTION><OPTION VALUE='Cancelled'>Cancelled</OPTION><OPTION VALUE='Shipped'>Shipped</OPTION><OPTION VALUE='Bad P.O. Number'>Bad P.O. Number</OPTION><OPTION VALUE='Invalid Order'>Invalid Order</OPTION><OPTION VALUE='Pending Req'>Pending Req</OPTION></SELECT>"
    	 Else   
    	 If Request("s1")="Resolution" Then
    	  s1="Resolution"
    	  selection_1_value="Resolution<br><SELECT NAME='selection_1_text'><OPTION VALUE=''></OPTION><OPTION VALUE='Issued New DRP P.O. Number'>Issued New DRP P.O. Number</OPTION><OPTION VALUE='Utilized Existing P.O. Number'>Utilized Existing P.O. Number</OPTION><OPTION VALUE='Modified STC'>Modified STC</OPTION><OPTION VALUE='Last Revision Date'>Last Revision Date</OPTION><OPTION VALUE='Changed Due Date'>Changed Due Date</OPTION><OPTION VALUE='Request PDC to Interface'>Request PDC to Interface</OPTION><OPTION VALUE='Called Supplier'>Called Supplier</OPTION><OPTION VALUE='WMS receipt not in DRP'>WMS receipt not in DRP</OPTION></SELECT>"
    	  Else   
    	  If Request("s1")="Chargeback" Then
    	   s1="Chargeback"
    	   selection_1_value="Chargeback<br><SELECT NAME='selection_1_text'><OPTION VALUE=''></OPTION><OPTION VALUE='Yes'>Yes</OPTION><OPTION VALUE='No'>No</OPTION></SELECT>"
    	   Else
    	   If Request("s1")="Team" Then
    		s1="Team"
    		selection_1_value="Team<br><SELECT NAME='selection_1_text'><OPTION VALUE=''></OPTION><OPTION VALUE='Aftermarket'>Aftermarket</OPTION><OPTION VALUE='Undercarriage'>Undercarriage</OPTION><OPTION VALUE='Product Support'>Product Support</OPTION><OPTION VALUE='Blue Diamond'>Blue Diamond</OPTION></SELECT>"
    		Else   
    		If Request("s1")="Unit Code" Then
    		 s1="Unit Code"
    		 selection_1_value="Unit Code<br><input type='text' name='selection_1_text' value=''>"
    		 Else   
    		 If Request("s1")="Date" Then
    		  s1="Date"
    		  selection_1_value="Date<br><input type='text' name='selection_1_text' value=''>"
    		  Else
    		  If Request("s1") <> "" Then
    		   s1=""
    		   selection_1_value=""
    		   Else
    		   s1="&nbsp;"
    		   selection_1_value="&nbsp;"
    		  End If   
    		 End If
    		End If
    	   End If
    	  End If
    	 End If
    	End If
       End If
      End If
     End If
    End If
    If Request("s2")="Supplier Code" Then
      s2="Supplier Code"
      selection_2_value="Supplier Code<br><input type='text' name='selection_2_text' value=''>"
     Else
     If Request("s2")="Part Number" Then
      s2="Part Number"
      selection_2_value="Part Number<br><input type='text' name='selection_2_text' value=''>"
      Else
      If Request("s2")="Customer Service Hotline" Then
       s2="Customer Service Hotline"
       selection_2_value="Customer Service Hotline<br><SELECT NAME='selection_2_text'><OPTION VALUE=''></OPTION><OPTION VALUE='Yes'>Yes</OPTION><OPTION VALUE='No'>No</OPTION></SELECT>"
       Else   
       If Request("s2")="Manual Packing List" Then
    	s2="Manual Packing List"
    	selection_2_value="Manual Packing List<br><SELECT NAME='selection_2_text'><OPTION VALUE=''></OPTION><OPTION VALUE='Yes'>Yes</OPTION><OPTION VALUE='No'>No</OPTION></SELECT>"
    	Else   
    	If Request("s2")="Issue" Then
    	 s2="Issue"
    	 selection_2_value="Issue<br><SELECT NAME='selection_2_text'><OPTION VALUE=''></OPTION><OPTION VALUE='No Manual Packing List'>No Manual Packing List</OPTION><OPTION VALUE='No P.O. Number On Packing List'>No P.O. Number On Packing List</OPTION><OPTION VALUE='No Packing List'>No Packing List</OPTION><OPTION VALUE='No Part Number'>No Part Number</OPTION><OPTION VALUE='Invalid Intl Part Number'>Invalid Intl Part Number</OPTION><OPTION VALUE='Supplier Part Number'>Supplier Part Number</OPTION><OPTION VALUE='Cancelled'>Cancelled</OPTION><OPTION VALUE='Shipped'>Shipped</OPTION><OPTION VALUE='Bad P.O. Number'>Bad P.O. Number</OPTION><OPTION VALUE='Invalid Order'>Invalid Order</OPTION><OPTION VALUE='Pending Req'>Pending Req</OPTION></SELECT>"
    	 Else   
    	 If Request("s2")="Resolution" Then
    	  s2="Resolution"
    	  selection_2_value="Resolution<br><SELECT NAME='selection_2_text'><OPTION VALUE=''></OPTION><OPTION VALUE='Issued New DRP P.O. Number'>Issued New DRP P.O. Number</OPTION><OPTION VALUE='Utilized Existing P.O. Number'>Utilized Existing P.O. Number</OPTION><OPTION VALUE='Modified STC'>Modified STC</OPTION><OPTION VALUE='Last Revision Date'>Last Revision Date</OPTION><OPTION VALUE='Changed Due Date'>Changed Due Date</OPTION><OPTION VALUE='Request PDC to Interface'>Request PDC to Interface</OPTION><OPTION VALUE='Called Supplier'>Called Supplier</OPTION><OPTION VALUE='WMS receipt not in DRP'>WMS receipt not in DRP</OPTION></SELECT>"
    	  Else   
    	  If Request("s2")="Chargeback" Then
    	   s2="Chargeback"
    	   selection_2_value="Chargeback<br><SELECT NAME='selection_2_text'><OPTION VALUE=''></OPTION><OPTION VALUE='Yes'>Yes</OPTION><OPTION VALUE='No'>No</OPTION></SELECT>"
    	   Else
    	   If Request("s2")="Team" Then
    		s2="Team"
    		selection_2_value="Team<br><SELECT NAME='selection_2_text'><OPTION VALUE=''></OPTION><OPTION VALUE='Aftermarket'>Aftermarket</OPTION><OPTION VALUE='Undercarriage'>Undercarriage</OPTION><OPTION VALUE='Product Support'>Product Support</OPTION><OPTION VALUE='Blue Diamond'>Blue Diamond</OPTION></SELECT>"
    		Else   
    		If Request("s2")="Unit Code" Then
    		 s2="Unit Code"
    		 selection_2_value="Unit Code<br><input type='text' name='selection_2_text' value=''>"
    		 Else   
    		 If Request("s2")="Date" Then
    		  s2="Date"
    		  selection_2_value="Date<br><input type='text' name='selection_2_text' value=''>"
    		  Else
    		  If Request("s2") <> "" Then
    		   s2=""
    		   selection_2_value=""
    		   Else
    		   s2="&nbsp;"
    		   selection_2_value="&nbsp;"
    		  End If   
    		 End If
    		End If
    	   End If
    	  End If
    	 End If
    	End If
       End If
      End If
     End If
    End If
    If Request("s3")="Supplier Code" Then
      s3="Supplier Code"
      selection_3_value="Supplier Code<br><input type='text' name='selection_3_text' value=''>"
     Else
     If Request("s3")="Part Number" Then
      s3="Part Number"
      selection_3_value="Part Number<br><input type='text' name='selection_3_text' value=''>"
      Else
      If Request("s3")="Customer Service Hotline" Then
       s3="Customer Service Hotline"
       selection_3_value="Customer Service Hotline<br><SELECT NAME='selection_3_text'><OPTION VALUE=''></OPTION><OPTION VALUE='Yes'>Yes</OPTION><OPTION VALUE='No'>No</OPTION></SELECT>"
       Else   
       If Request("s3")="Manual Packing List" Then
    	s3="Manual Packing List"
    	selection_3_value="Manual Packing List<br><SELECT NAME='selection_3_text'><OPTION VALUE=''></OPTION><OPTION VALUE='Yes'>Yes</OPTION><OPTION VALUE='No'>No</OPTION></SELECT>"
    	Else   
    	If Request("s3")="Issue" Then
    	 s3="Issue"
    	 selection_3_value="Issue<br><SELECT NAME='selection_3_text'><OPTION VALUE=''></OPTION><OPTION VALUE='No Manual Packing List'>No Manual Packing List</OPTION><OPTION VALUE='No P.O. Number On Packing List'>No P.O. Number On Packing List</OPTION><OPTION VALUE='No Packing List'>No Packing List</OPTION><OPTION VALUE='No Part Number'>No Part Number</OPTION><OPTION VALUE='Invalid Intl Part Number'>Invalid Intl Part Number</OPTION><OPTION VALUE='Supplier Part Number'>Supplier Part Number</OPTION><OPTION VALUE='Cancelled'>Cancelled</OPTION><OPTION VALUE='Shipped'>Shipped</OPTION><OPTION VALUE='Bad P.O. Number'>Bad P.O. Number</OPTION><OPTION VALUE='Invalid Order'>Invalid Order</OPTION><OPTION VALUE='Pending Req'>Pending Req</OPTION></SELECT>"
    	 Else   
    	 If Request("s3")="Resolution" Then
    	  s3="Resolution"
    	  selection_3_value="Resolution<br><SELECT NAME='selection_3_text'><OPTION VALUE=''></OPTION><OPTION VALUE='Issued New DRP P.O. Number'>Issued New DRP P.O. Number</OPTION><OPTION VALUE='Utilized Existing P.O. Number'>Utilized Existing P.O. Number</OPTION><OPTION VALUE='Modified STC'>Modified STC</OPTION><OPTION VALUE='Last Revision Date'>Last Revision Date</OPTION><OPTION VALUE='Changed Due Date'>Changed Due Date</OPTION><OPTION VALUE='Request PDC to Interface'>Request PDC to Interface</OPTION><OPTION VALUE='Called Supplier'>Called Supplier</OPTION><OPTION VALUE='WMS receipt not in DRP'>WMS receipt not in DRP</OPTION></SELECT>"
    	  Else   
    	  If Request("s3")="Chargeback" Then
    	   s3="Chargeback"
    	   selection_3_value="Chargeback<br><SELECT NAME='selection_3_text'><OPTION VALUE=''></OPTION><OPTION VALUE='Yes'>Yes</OPTION><OPTION VALUE='No'>No</OPTION></SELECT>"
    	   Else
    	   If Request("s3")="Team" Then
    		s3="Team"
    		selection_3_value="Team<br><SELECT NAME='selection_3_text'><OPTION VALUE=''></OPTION><OPTION VALUE='Aftermarket'>Aftermarket</OPTION><OPTION VALUE='Undercarriage'>Undercarriage</OPTION><OPTION VALUE='Product Support'>Product Support</OPTION><OPTION VALUE='Blue Diamond'>Blue Diamond</OPTION></SELECT>"
    		Else   
    		If Request("s3")="Unit Code" Then
    		 s3="Unit Code"
    		 selection_3_value="Unit Code<br><input type='text' name='selection_3_text' value=''>"
    		 Else   
    		 If Request("s3")="Date" Then
    		  s3="Date"
    		  selection_3_value="Date<br><input type='text' name='selection_3_text' value=''>"
    		  Else
    		  If Request("s3") <> "" Then
    		   s3=""
    		   selection_3_value=""
    		   Else
    		   s3="&nbsp;"
    		   selection_3_value="&nbsp;"
    		  End If   
    		 End If
    		End If
    	   End If
    	  End If
    	 End If
    	End If
       End If
      End If
     End If
    End If
    response.write s1 & "<BR>"
    response.write s2 & "<BR>"
    response.write s3 & "<BR>"
    '
    If Request.form("submit") <> "" Then
    dim s1t,s2t,s3t,url
     If Request.form("selection_1_text")<>"" AND Request.form("selection_2_text")="" AND Request.form("selection_3_text")="" Then
      url="search_results.asp?s1=" & s1 & "&s1t=" & Request.form("selection_1_text")
      Else
      If Request.form("selection_1_text")<>"" AND Request.form("selection_2_text")<>"" AND Request.form("selection_3_text")="" Then
       url="search_results.asp?s1=" & s1 & "&s1t=" & Request.form("selection_1_text") & "&s2=" & s2 & "&s2t=" & Request.form("selection_2_text")
       Else
       If Request.form("selection_1_text")<>"" AND Request.form("selection_2_text")<>"" AND Request.form("selection_3_text")<>"" Then
    	url="search_results.asp?s1=" & s1 & "&s1t=" & Request.form("selection_1_text") & "&s2=" & s2 & "&s2t=" & Request.form("selection_2_text") & "&s3=" & s3 & "s3t=" & Request.form("selection_3_text")
    	Else
       End If
      End If
     End If
    response.write url
    '  response.write("<script>" & vbCrLf)
    '  response.write("parent.frames['bottom_search'].location.replace('" & url & "');" & vbCrLf)
    '  response.write("</script>")
    End If
    %>
    </head>
    <body topmargin="0" leftmargin="0">
    <p align=center>
    <form action="search_drop_downs2.asp" name="search_drop_downs2" method="post">
    <table cellpadding="3" cellspacing="0" border="0" bordercolor=" #000000" width="100%">
     <tr>
     <td><p align=center>
      
     <%=selection_1_value%>
     </td>
     <td><p align=center>
     <%=selection_2_value%>
     </td>
     <td><p align=center>
     <%=selection_3_value%>
     </td>
     <td valign=bottom><p align=center><input type="submit" name="submit" value="Search">
     </td>
     </tr>
    </table>
    </form>
    </body>
    </html>

  2. #2
    SitePoint Addict
    Join Date
    Aug 2003
    Location
    IL
    Posts
    292
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The important section is this
    Code:
    response.write s1 & "<BR>"
    response.write s2 & "<BR>"
    response.write s3 & "<BR>"
    '
    If Request.form("submit") <> "" Then
    dim s1t,s2t,s3t,url
     If Request.form("selection_1_text")<>"" AND Request.form("selection_2_text")="" AND Request.form("selection_3_text")="" Then
      url="search_results.asp?s1=" & s1 & "&s1t=" & Request.form("selection_1_text")
      Else
      If Request.form("selection_1_text")<>"" AND Request.form("selection_2_text")<>"" AND Request.form("selection_3_text")="" Then
       url="search_results.asp?s1=" & s1 & "&s1t=" & Request.form("selection_1_text") & "&s2=" & s2 & "&s2t=" & Request.form("selection_2_text")
       Else
       If Request.form("selection_1_text")<>"" AND Request.form("selection_2_text")<>"" AND Request.form("selection_3_text")<>"" Then
    	url="search_results.asp?s1=" & s1 & "&s1t=" & Request.form("selection_1_text") & "&s2=" & s2 & "&s2t=" & Request.form("selection_2_text") & "&s3=" & s3 & "s3t=" & Request.form("selection_3_text")
    	Else
       End If
      End If
     End If
    response.write url
    '  response.write("<script>" & vbCrLf)
    '  response.write("parent.frames['bottom_search'].location.replace('" & url & "');" & vbCrLf)
    '  response.write("</script>")
    End If
    It shows that I response.write the s1 s2 and s3 values (and they all come out fine) but once it enters the If Request.form("submit") <> "" Then conditional the value somehow gets lost. help?

  3. #3
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Some pointers,

    Your last section (the important stuff) can be better written as:
    Code:
    If Len(Request.form("submit")) > 0 Then
    	url = "search_results.asp"
    	If Len(Request("selection_1_text")) > 0 Then
    		url = url & "?s1=" & s1 & "&s1t=" & Request("selection_1_text")
    		If Len(Request("selection_2_text")) > 0 Then
    			url = url & "&s2=" & s2 & "&s2t=" & Request("selection_2_text")
    			If Len(Request("selection_3_text")) > 0 Then
    				url = url & "&s3=" & s3 & "&s3t=" & Request("selection_3_text")
    			End If	
    		End If
    	End If
    End If
    As for the rest, I strongly recommend the use of 1 Select Case instead of 15 million nested Ifs.

  4. #4
    SitePoint Addict
    Join Date
    Aug 2003
    Location
    IL
    Posts
    292
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Couple questions.
    - What exactly does Len do? Ive seen it all over, but don't understand it.
    - What exactly do you mean by Select Case?

  5. #5
    SitePoint Addict
    Join Date
    Aug 2003
    Location
    IL
    Posts
    292
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    just tried using your snippet of code and (dont know if it was supposed to help fix the problem or just simply make the code cleaner) it didnt fix the problem, I'm still coming across with 's1=&s1t=Issued New DRP P.O. Number'

  6. #6
    SitePoint Enthusiast
    Join Date
    Feb 2005
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What Jim is suggesting by Select case is an alternative to your IF-THEN-ELSE statements...

    Check this out for an example..
    http://www.asp101.com/samples/case.asp

    Len checks for the length of a given string...
    http://pacosdrivers.com/asp/Len/

  7. #7
    SitePoint Addict
    Join Date
    Aug 2003
    Location
    IL
    Posts
    292
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    figured out my problem, I need to put the s1=" & s1 & "&s2= blah blah blah in the action part of the form in order for it to carry over.

  8. #8
    SitePoint Addict
    Join Date
    Aug 2003
    Location
    IL
    Posts
    292
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    so, technically, I could probably replace all my if then's with select.... What's the point of if thens then?

  9. #9
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Select Case only tests 1 condition, where with an if you can test many:

    Select Case nTest
    Case 1
    Do This
    Case 0
    Do That
    End Select

    vs

    If nTest = 0 And myString = "hi" Then
    Do This
    ElseIf nTest = 1 Or myString = "bye" Then
    Do That
    End If


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •