By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,867 Members | 1,964 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,867 IT Pros & Developers. It's quick & easy.

Form will not direct to the emails

P: 1
Hi: I am having issues with the below code. I can not figure out why the form will not direct to the appropriate email based on the state that is selected. It will only direct to "Other". Please help! I am at a loss...

Expand|Select|Wrap|Line Numbers
  1. <%@ Language=VBScript %>
  2. <!--#include file="../common.asp" -->
  3. <!--#include file="../commands.asp" -->
  4. <%
  5.  
  6.  
  7.         Dim Country, State, CountryOther, email, PartNumber, TodayIs
  8.         Dim sql
  9.  
  10.  
  11.         todayis=Now()
  12.         Country=Request.Form("Country")
  13.         State=Request.Form("state")
  14.         CountryOther=Request.form("other")
  15.         Email=Request.form("email")
  16.         PartNumber=Request.Form("PartNumber")
  17.  
  18.  
  19.     '    Determines where the email will be directed
  20.     '    Determines the subject line
  21.     if  Country = "USA" then select case true
  22.             case state = "AK"
  23.                   Emailto = "JViner@amphenolrf.com"
  24.             case state = "AL"
  25.                  emailto = "CPrada@amphenolrf.com"
  26.             case state = "AR" 
  27.                  emailto = "LLOFRUMENTO@AMPHENOLRF.COM"
  28.             case state = "AZ"
  29.                  EMAILTO = "CFinch@amphenolrf.com"
  30.             case state = "CA"
  31.                  emailto = "CFinch@amphenolrf.com,JShah@amphenolrf.com,JViner@amphenolrf.com"
  32.             case state = "CO"
  33.                  emailto = "JShah@amphenolrf.com"
  34.             case state = "CT"
  35.                   Emailto = "MBurke@amphenolrf.com"
  36.             case state = "DE"
  37.                   Emailto = "CMullaly@amphenolrf.com"
  38.             case state = "FL"
  39.                   Emailto = "CPrada@amphenolrf.com"
  40.             case state = "GA"
  41.                   Emailto = "CPrada@amphenolrf.com"
  42.             case state = "HI"
  43.                  emailto = "CFinch@amphenolrf.com"
  44.             case state = "ID"
  45.                  emailto = "JViner@amphenolrf.com"
  46.             case state = "IL"
  47.                      EMAILTO = "GNeidlinger@amphenolrf.com"
  48.             case state = "IN"
  49.                      EMAILTO = "GNeidlinger@amphenolrf.com"
  50.             case state = "IA"
  51.                      EMAILTO = "GNeidlinger@amphenolrf.com"
  52.             case state = "KS"
  53.                      EMAILTO = "GNeidlinger@amphenolrf.com"
  54.             case state = "KY"
  55.                      EMAILTO = "GNeidlinger@amphenolrf.com"
  56.             case state = "LA"
  57.                      EMAILTO = "CFinch@amphenolrf.com"
  58.             case state = "MA"
  59.                   Emailto = "Mburke@amphenolrf.com"
  60.             case state = "MD"
  61.                   Emailto = "CMullaly@amphenolrf.com"
  62.             case state = "ME"
  63.                   Emailto = "Mburke@amphenolrf.com"
  64.             case state = "MI"
  65.                      EMAILTO = "GNeidlinger@amphenolrf.com"
  66.             case state = "MN"
  67.                      EMAILTO = "GNeidlinger@amphenolrf.com"
  68.             case state = "MS"
  69.                   Emailto = "CPrada@amphenolrf.com"
  70.             case state = "MO"
  71.                      EMAILTO = "GNeidlinger@amphenolrf.com"
  72.             case state = "MT"
  73.                  emailto = "JShah@amphenolrf.com"
  74.             case state = "NC"
  75.                      EMAILTO = "CMullaly@amphenolrf.com"
  76.             case state = "ND"
  77.                  emailto = "GNeidlinger@amphenolrf.com"
  78.             case state = "NH"
  79.                   Emailto = "Mburke@amphenolrf.com"
  80.             case state = "NJ"
  81.                   Emailto = "CMullaly@amphenolrf.com"
  82.             case state = "NM"
  83.                  emailto = "CFinch@amphenolrf.com"
  84.             case state = "NY"
  85.                   Emailto = "Mburke@amphenolrf.com"
  86.             case state = "NV"
  87.                   Emailto = "CFinch@amphenolrf.com" "JShah@amphenolrf.com" "JViner@amphenolrf.com"
  88.             case state = "ND"
  89.                      EMAILTO = "GNeidlinger@amphenolrf.com"
  90.             case state = "OH"
  91.                      EMAILTO = "GNeidlinger@amphenolrf.com"
  92.             case state = "OK"
  93.                      EMAILTO = "GNeidlinger@amphenolrf.com"
  94.             case state = "OR"
  95.                  emailto = "JViner@amphenolrf.com"
  96.             case state = "PA"
  97.                   Emailto = "GNeidlinger@amphenolrf.com,CMullaly@amphenolrf.com"
  98.             case state = "RI"
  99.                   Emailto = "Mburke@amphenolrf.com"
  100.             case state = "SC"
  101.                   Emailto = "CMullaly@amphenolrf.com"
  102.             case state = "SD"
  103.                  EMAILTO = "GNeidlinger@amphenolrf.com"
  104.             case state = "TN"
  105.                 EMAILTO = "CPrada@amphenolrf.com"
  106.             case state = "TX"
  107.                 EMAILTO = "CFinch@amphenolrf.com"
  108.             case state = "UT"
  109.                  emailto = "JShah@amphenolrf.com"
  110.             case state = "VT"
  111.                   Emailto = "mburke@amphenolrf.com"
  112.             case state = "VA"
  113.                   Emailto = "CMullaly@amphenolrf.com"
  114.             case state = "WA"
  115.                  emailto = "JViner@amphenolrf.com"
  116.             case state = "WV"
  117.                   Emailto = "CMullaly@amphenolrf.com"
  118.             case state = "WI"
  119.                      EMAILTO = "GNeidlinger@amphenolrf.com"
  120.             case state = "WY"
  121.                  emailto = "JShah@amphenolrf.com"
  122.             case else
  123.                 EMAILTO = "RCISTO@AMPHENOLRF.COM"
  124. if  Country = "CANADA" then Emailto = "RCISTO@AMPHENOLRF.COM"
  125. if  Country = "INDIA" then Emailto = "RCISTO@AMPHENOLRF.COM"
  126. if  Country = "OTHER" then Emailto = "RCISTO@AMPHENOLRF.COM"
  127.         END SELECT
  128.  
  129.     end if     
  130.     subject = "Customer has requested IGS file"
  131.  
  132.     message=request("message")
  133.     message=replace(message,"'","''")
  134.  
  135.     '    Error Checking
  136.  
  137.     if state  = "select" then
  138.         error=1
  139.         s_error=1
  140.     end if
  141.  
  142.     if Country  = "select" then
  143.         error=1
  144.         c_error=1
  145.     end if
  146.  
  147.     if other = "Country" then
  148.     error = 1
  149.     c_error =1
  150.     end if 
  151.  
  152.     if email="" then
  153.         error=1
  154.         l_error=1
  155.     end if
  156.  
  157.     if PartNumber="" then
  158.         error=1
  159.         p_error=1
  160.     end if
  161.  
  162.     set fs = CreateObject("Scripting.FileSystemObject")
  163.     path = Server.MapPath("../IGSFiles/")
  164.     'set folder = fs.GetFolder(path) 
  165.  
  166.     function SearchFolderContents(path,PartNumber)
  167.  
  168.         dim fs, fileBool
  169.  
  170.         set fs = CreateObject("Scripting.FileSystemObject")
  171.  
  172.         'Response.Write(path & "\" & PartNumber & ".zip" & vbCrLf)
  173.  
  174.         if fs.FileExists(path & "\" & PartNumber & ".zip")=true then
  175.             fileBool = true
  176.         else
  177.             fileBool = false
  178.         end if
  179.         set fs=nothing
  180.  
  181.         SearchFolderContents = fileBool
  182.  
  183.     end function
  184.  
  185.     hasFile = SearchFolderContents(path,PartNumber)
  186.  
  187.     if SearchFolderContents(path,PartNumber) = false then 
  188.         error=1
  189.         p2_error=1
  190.     end if
  191.  
  192.     if error<>0 then
  193.  
  194.     %>
  195.  
  196.  
  197.     <html>
  198.         <head>
  199.         <title>Amphenol RF</title>
  200.         <link href="RFStyle.css" rel="stylesheet" type="text/css">
  201.         <script language="JavaScript1.2" type="text/javascript" src="/includefiles/headeriframe/mm_css_menu.js"></script>
  202.         <script language="JavaScript" src="gen_validatorv31.js" type="text/javascript"></script>
  203.  
  204.  
  205.         <style type="text/css" media="screen">
  206.             @import url("/includefiles/headeriframe/menu.css");
  207.         </style>
  208.         <% Response.Buffer = True %>
  209.         <body>
  210.  
  211.         <!--#include virtual="/includefiles/headeriframe/menu.asp"-->
  212.         <table width="100%" border="0" cellspacing="0" cellpadding="0">
  213.           <tr>
  214.             <td width="126" align="left" valign="top"><!--#include virtual="../includefiles/nav.asp" --></td>
  215.         <td style="width:7px; background-image:url(../images/dot_border.gif); vertical-align:top"><img src="http://bytes.com/topic/asp-classic/images/arf_colorwhite.gif" width="7" height="2" alt=""></td>
  216.         <td width="100%" align="left" valign="top">
  217.              <img src="http://bytes.com/topic/asp-classic/images/p2titles_contact.gif" width="600" height="39"><br>
  218.               <img src="http://bytes.com/topic/asp-classic/images/invisi.gif" width="20" height="8">&nbsp;<br>
  219.               <br>
  220.  
  221.               <table width="600" border="0" cellspacing="0" cellpadding="0">
  222.                 <tr>
  223.                   <td rowspan="3" width="10"><img src="http://bytes.com/topic/asp-classic/images/invisi.gif" width="10" height="5" alt=""></td>
  224.  
  225.                   <td colspan="3"><img src="http://bytes.com/topic/asp-classic/images/stripe1.gif" width="590" height="10" alt=""></td>
  226.                 </tr>
  227.                 <tr>
  228.                   <td  style="background:#FFFFFF; background-image:url(../images/white.gif); width:10px"><img src="http://bytes.com/topic/asp-classic/images/invisi.gif" width="10" height="5" alt=""></td>
  229.                   <td bgcolor="#FFFFFF" background="../images/white.gif" width="570" align="left" valign="top"><img src="http://bytes.com/topic/asp-classic/images/invisi.gif" width="570" height="1"><br>
  230.  
  231.                     <% if s_error=1 or c_error=1 or l_error=1 or p_error=1 then %>
  232.                     <br>
  233.                     <b>Please go back and provide the following information:</b>
  234.                     <br>
  235.                     <br>
  236.                     <%end if%>
  237.                     <%if s_error=1 then%>
  238.                     State
  239.                     <br>
  240.                     <%end if%>
  241.  
  242.                      <%if c_error=1 then%>
  243.                     Country
  244.                     <br>
  245.                     <%end if%>
  246.  
  247.                     <%if l_error=1 then%>
  248.                     E-Mail Address
  249.                     <br>
  250.                        <%end if%>
  251.  
  252.                     <%if p_error=1 then%>
  253.                     Part Number
  254.                     <br>
  255.                        <%end if%>
  256.  
  257.                     <%if  p_error<>1 and s_error<>1 and l_error<>1 and c_error<>1 then%>
  258.                     <%if p2_error=1 then%>
  259.                     We apologize, there does not seem to be an IGS file for part number <%=PartNumber%>. You will recieve a file to the e-mail provided  as soon as possible. The folloing information has been submitted:
  260.                    <%end if%>
  261.                  <%
  262.  
  263.  
  264.         On Error Resume Next
  265.  
  266.  
  267.         OpenDatabase()
  268.  
  269.                 if  Country ="Other" then 
  270.  
  271.                     sql="insert into tblIGS_Requests (Country, State, Email, PartNumber, Date, Avail) values ('" & CountryOther & "', '" & State & "', '" & email & "', '" & PartNumber & "', '" & todayis & "' , 'No')" 
  272.  
  273.                 else
  274.  
  275.                     sql="insert into tblIGS_Requests (Country, State, Email, PartNumber, Date, Avail) values ('" & Country & "', '" & State & "', '" & email & "', '" & PartNumber & "', '" & todayis & "' , 'No')" 
  276.  
  277.                 end if
  278.  
  279.     connect.Execute(sql)
  280.     CloseDatabase()
  281.  
  282.  
  283. '    Sends the emails
  284.  
  285.            '    Sends the emails to Me
  286.  
  287.          Set Mail = Server.CreateObject("Persits.MailSender")
  288.             Mail.Host = "10.1.2.126"
  289.             Mail.From = email
  290.             Mail.FromName = "Amphenol RF.com Website"
  291.             Mail.AddAddress emailto , "AmphenolRF.com"
  292.             Mail.AddAddress "igsrequest@amphenolrf.com"
  293.             Mail.AddAddress "ogefen@amphenolrf.com"
  294.             Mail.Subject = "Customer has requested IGS File"
  295.             Mail.Body = "Message: " & vbcrlf &_
  296.  
  297.         "Country: " & Request.Form("Country") & Request.Form("other")  & vbcrlf &_
  298.         "State: "& Request.Form("state") & vbcrlf &_
  299.         "E-mail: " & Request.form("email")& vbcrlf &_
  300.         "Part Number: "& Request.Form("PartNumber") & vbcrlf &_
  301.         Request.form("message")
  302.  
  303.             Mail.Send()
  304.                    %>
  305.  
  306.  
  307.                     <br>
  308.                        <%end if%>
  309.  
  310.                     <br>
  311.                     <%=font2%><a href="javascript:history.go(-1)" onMouseOver="self.status=document.referrer;return true"><img src="http://bytes.com/topic/asp-classic/images/back.gif" border="0"></a></font>
  312.                     <br>
  313.                     <br>
  314.                     </font></td>
  315.                   <td  style="background:#FFFFFF; background-image:url(../images/white.gif); width:10px"><img src="http://bytes.com/topic/asp-classic/images/invisi.gif" width="10" height="5" alt=""></td>
  316.                 </tr>
  317.                 <tr>
  318.                   <td colspan="3"><img src="http://bytes.com/topic/asp-classic/images/stripe2.gif" width="590" height="10" alt=""></td>
  319.                 </tr>
  320.               </table>
  321.               <br>
  322.               <br>
  323.               <br>
  324.               <br>
  325.               <br>
  326.               <br>
  327.               <br>
  328.               <br>
  329.               <br>
  330.               <br>
  331.               <br>
  332.               <br>
  333.               <br>
  334.               <br>
  335.               <br>
  336.  
  337.  
  338.               </td>
  339.           </tr>
  340.         </table>
  341.         <!--#include file="../includefiles/copyright.html" -->
  342.         </body>
  343.         </html>
  344.  
  345.         <%else
  346.  
  347.         On Error Resume Next
  348.  
  349.         ' in database if there IS a file
  350.  
  351.  
  352.                 OpenDatabase()
  353.  
  354.                 if  Country ="Other" then 
  355.  
  356.                     sql="insert into tblIGS_Requests (Country, State, Email, PartNumber, Date, Avail) values ('" & CountryOther & "', '" & State & "', '" & email & "', '" & PartNumber & "', '" & todayis & "' , 'Yes')" 
  357.  
  358.                 else
  359.  
  360.                     sql="insert into tblIGS_Requests (Country, State, Email, PartNumber, Date, Avail) values ('" & Country & "', '" & State & "', '" & email & "', '" & PartNumber & "', '" & todayis & "' , 'Yes')" 
  361.  
  362.                 end if
  363.              connect.Execute(sql)            
  364.                 CloseDatabase()
  365.  
  366.  
  367.  
  368.  
  369.         '    Sends the emails to Amphenol
  370.  
  371.         Set Mail = Server.CreateObject("Persits.MailSender")
  372.             Mail.Host = "10.1.2.126"
  373.             Mail.From = email
  374.             Mail.FromName = "Amphenol RF.com Website"
  375.             Mail.AddAddress emailto , "AmphenolRF.com"
  376.             Mail.AddAddress "igsrequest@amphenolrf.com"
  377.             Mail.Subject = "Customer has requested IGS File"
  378.             Mail.Body = "Message: " & vbcrlf &_
  379.  
  380.         "Country: " & Request.Form("Country") & Request.Form("other")  & vbcrlf &_
  381.         "State: "& Request.Form("state") & vbcrlf &_
  382.         "E-mail: " & Request.form("email")& vbcrlf &_
  383.         "Part Number: "& Request.Form("PartNumber") & vbcrlf &_
  384.         Request.form("message")
  385.  
  386.       Mail.Send()
  387.  
  388.         '    Sends a comfirmation email to the user
  389.         Set Mail = Server.CreateObject("Persits.MailSender")
  390.             Mail.Host = "10.1.2.126"
  391.             Mail.From = emailto
  392.             Mail.FromName = "Amphenol RF.com Website"
  393.             Mail.AddAddress email
  394.  
  395.             Mail.Subject = "Thank you for visiting AmphenolRF"
  396.             Mail.Body = "Message: " & vbcrlf &_
  397.  
  398.         "Thank you for visiting AmphenolRF.com" & vbcrlf & vbcrlf &_
  399.         "You provided the following information:" & vbcrlf & vbcrlf &_
  400.  
  401.  
  402.         "E-mail: " & Request.form("email")& vbcrlf &_
  403.         "Part Number: "&Request.Form("PartNumber") & vbcrlf & _
  404.  
  405.         "Thank you once again for your interest in Amphenol RF." & vbcrlf & vbcrlf &_
  406.         "Please feel free to ask any questions you may have."
  407.  
  408.        Mail.Send()
  409.  
  410.         On Error goto 0
  411.  
  412.         %>
  413.  
  414.         <html>
  415.         <head>
  416.         <title>Amphenol RF</title>
  417.         <!--#include file="../includefiles/meta.html"-->
  418.         <!--#include file="../includefiles/javascript.html"-->
  419.         </head>
  420.  
  421.  
  422.         <body>
  423.  
  424.  
  425.  
  426.         <!--#include virtual="/../includefiles/logo_nav.asp"-->
  427.  
  428.         <table width="100%" border="0" cellspacing="0" cellpadding="0">
  429.           <tr>
  430.             <td width="126" align="left" valign="top"><!--#include virtual="/../includefiles/nav.asp" --></td>
  431.         <td style="width:7px; background-image:url(../images/dot_border.gif); vertical-align:top"><img src="http://bytes.com/topic/asp-classic/images/arf_colorwhite.gif" width="7" height="2" alt=""></td>
  432.         <td width="100%" align="left" valign="top"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><img src="http://bytes.com/topic/asp-classic/images/p2titles_contact.gif" width="600" height="39"><br>
  433.               <img src="http://bytes.com/topic/asp-classic/images/invisi.gif" width="20" height="8">&nbsp;<a href="contactus.asp">Amphenol
  434.               RF</a> | <a href="contactrep.asp">Manufacturer's Representative</a><br>
  435.               <br>
  436.               <img src="http://bytes.com/topic/asp-classic/images/invisi.gif" width="15" height="8"><img src="http://bytes.com/topic/asp-classic/images/p2subtitles_contactus.gif" width="300" height="28"><br>
  437.               </font>
  438.               <table width="600" border="0" cellspacing="0" cellpadding="0">
  439.                 <tr>
  440.                   <td rowspan="3" width="10"><img src="http://bytes.com/topic/asp-classic/images/invisi.gif" width="10" height="5" alt=""></td>
  441.                   <td colspan="3"><img src="http://bytes.com/topic/asp-classic/images/stripe1.gif" width="590" height="10"></td>
  442.                 </tr>
  443.                 <tr>
  444.                   <td  style="background:#FFFFFF; background-image:url(../images/white.gif); width:10px"><img src="http://bytes.com/topic/asp-classic/images/invisi.gif" width="10" height="5" alt=""></td>
  445.                   <td bgcolor="#FFFFFF" background="../images/white.gif" width="570" align="left" valign="top"><%=font2%><img src="http://bytes.com/topic/asp-classic/images/invisi.gif" width="570" height="1"><br>
  446.                     <br>
  447.                     Thank you for visiting AmphenolRF.com
  448.                     <br>
  449.                     <br>
  450.                     E-Mail Address:<%=email%>
  451.                     <br>
  452.                     Part Number: <%=PartNumber%>
  453.                     <br><br>
  454.                     <a href="/IGSFiles/<%=PartNumber%>.zip">Click here to download your file</a><br><br>
  455.                    </td>
  456.                   <td  style="background:#FFFFFF; background-image:url(../images/white.gif); width:10px"><img src="http://bytes.com/topic/asp-classic/images/invisi.gif" width="10" height="5" alt=""></td>
  457.                 </tr>
  458.                 <tr>
  459.                   <td colspan="3"><img src="http://bytes.com/topic/asp-classic/images/stripe2.gif" width="590" height="10" alt=""></td>
  460.                 </tr>
  461.               </table>
  462.               </font></td>
  463.           </tr>
  464.         </table><!--#include file="../includefiles/copyright.html" -->
  465.         </body>
  466.     </html>
  467. <%end if%>
Sep 8 '13 #1
Share this Question
Share on Google+
2 Replies


Rabbit
Expert Mod 10K+
P: 12,370
I don't know which line of code you are referring to.
Sep 9 '13 #2

cgiAlexis
P: 12
Noobie here but looks like maybe you want to go and get a coffee then come back.

Expand|Select|Wrap|Line Numbers
  1. Line 47 If other = "country"
Is that meant to equate the return from form 'other' to the value in control 'country', or is it as I suspect that you meant to put:

Expand|Select|Wrap|Line Numbers
  1. If Country = "other"

Otherwise you want to look at how the control that the user is entering the country into is handling the text "USA" correctly. If for some reason the text is gaining a non character like a space then your VBA will detect it as "USA " rather than "USA".

A quick check is to set all your IF detections to
Expand|Select|Wrap|Line Numbers
  1.    if  Country =  "*" & "USA" & "*" then select case true 
  2.  
This will negate spelling mistakes but can pick up similar strings. It still shouldn't throw an error since you're detecting USA, Canada, India, Other none of which share the string "usa".

Hth
Regards,
Alexis
Sep 10 '13 #3

Post your reply

Sign in to post your reply or Sign up for a free account.