<% Dim strURL strURL = Request.ServerVariables("HTTP_REFERER") IF strURL = "http://www.oceanlogistics.co.uk/processform.asp" THEN 'OR strURL = "http://www.oceanlogistics.co.uk/quotation_fax.asp" Response.Redirect "http://www.oceanlogistics.co.uk/" ELSE %> <% Dim emailsent emailsent=0 '================================= 'All fields are acted as required ' except those the NAME of which ' is in this string variable: '================================= 'REMEMBER VALUES OF CHECK BOXES ETC AFTER VALIDATING! Dim chk_q_grossweightunit,chk_q_dimensions,chk_q_dimensionsunit,chk_q_hazardous,chk_q_handling,chk_q_specialhandling,chk_q_deliveryby,chk_q_deliveryto,chk_q_insurance,chk_q_quotewithoutinsurance,chk_formaction chk_q_grossweightunit = Request.Form("q_grossweightunit") chk_q_dimensions = Request.Form("q_dimensions") chk_q_dimensionsunit = Request.Form("q_dimensionsunit") chk_q_hazardous = Request.Form("q_hazardous") chk_q_handling = Request.Form("q_handling") chk_q_specialhandling = Request.Form("q_specialhandling") chk_q_deliveryby = Request.Form("q_deliveryby") chk_q_deliveryto = Request.Form("q_deliveryto") chk_q_insurance = Request.Form("q_insurance") chk_q_quotewithoutinsurance = Request.Form("q_quotewithoutinsurance") chk_formaction = Request.Form("formaction") IF chk_q_handling="No" THEN exceptions = Array("q_grossweightunit","q_dimensions","q_dimensionsunit","q_hazardous","q_handling","q_specialhandling","q_deliveryby","q_deliveryto","q_insurance","q_quotewithoutinsurance","formaction") ELSE exceptions = Array("q_grossweightunit","q_dimensions","q_dimensionsunit","q_hazardous","q_handling","q_deliveryby","q_deliveryto","q_insurance","q_quotewithoutinsurance","formaction") END IF '================================= 'NAME of the e-mail field is ' stored in this string variable: '================================= emailField = "q_email" '================================= 'Variables '================================= dim errorMessage, badItem, inputArray() : badItem=-1 redim inputArray(50,2) '================================= 'Get all what is submitted '================================= IF request.Form.Count > 0 THEN execute("const numberOfFields =" & request.Form.Count) execute("redim inputArray("&numberOfFields&",2)") FOR i = 1 TO request.Form.Count inputArray(i,1) = request.Form.Key(i) inputArray(i,2) = request.Form.Item(i) NEXT validate ELSEIF request.QueryString.Count > 0 THEN execute("const numberOfFields =" & request.QueryString.Count) execute("redim inputArray("&numberOfFields&",2)") FOR i = 1 TO request.QueryString.Count inputArray(i,1) = request.QueryString.Key(i) inputArray(i,2) = request.QueryString.Item(i) NEXT validate END IF SUB validate '================================= 'Check for empty fields '================================= FOR i = 1 TO numberOfFields isException = False IF inputArray(i,2)="" THEN FOR j = 0 to UBound(exceptions) IF inputArray(i,1) = exceptions(j) THEN isException = TRUE NEXT IF NOT isException THEN badItem = i errorMessage = "At least one of the required fields is empty." EXIT SUB END IF END IF isException = False NEXT '================================= 'Check email address for basic ' errors '================================= FOR i = 1 TO numberOfFields IF emailField=inputArray(i,1) THEN validationResult = validateEmail(inputArray(i,2)) IF validationResult <> "" THEN errorMessage = validationResult badItem = i END IF END IF NEXT END SUB FUNCTION validateEmail(strAddress) IF InStr(strAddress,"@") < 2 THEN validateEmail = "Your email address must contain ""@"" sign." ELSEIF InStr(Right(strAddress,Len(strAddress)-InStr(strAddress,"@")),".") < 2 OR InStr(Right(strAddress,Len(strAddress)-InStr(strAddress,"@")),".") = Len(strAddress)-InStr(strAddress,"@") THEN validateEmail = "Your email address must contain a ""."" after the @ sign." ' ELSE ' host = Right(strAddress,Len(strAddress)-InStr(strAddress,"@")) ' IF NOT MXLookUp(host) THEN validateEmail = "Bad email address." END IF END FUNCTION 'FUNCTION MXLookUp(host) ' MXLookUp = False ' Dim objXMLHTTP,strResult ' Set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP") ' objXMLHTTP.Open "Get", _ ' "http://examples.softwaremodules.com/IntraDns.asp?domainname=" & host & "&Submit=Submit&t_mx=1", False ' objXMLHTTP.Send ' strResult = objXMLHTTP.ResponseText ' strResult = Mid(strResult,InStr(strResult,"(MX) for "),100) ' strResult = Mid(strResult,Instr(strResult,". Items ed: ")+35,1) ' IF CInt(strResult) > 0 THEN ' MXLookUp = TRUE ' ELSE ' MXLookUp = FALSE ' END IF 'END FUNCTION 'DATA FROM FORM Dim q_contact,q_companyname,q_email,q_telephone,q_fax,q_origaddress,q_origcity,q_origcounty,q_origpostcode,q_origcountry,q_destaddress,q_destcity,q_destcounty,q_destpostcode,q_destcountry,q_commodity,q_pieces,q_grossweight,q_dimensions,q_declaredvalue,q_hazardous,q_handling,q_specialhandling,q_deliveryby,q_deliveryto,q_insurance,q_quotewithoutinsurance,formaction txt_q_contact = Request.Form("q_contact") txt_q_companyname = Request.Form("q_companyname") txt_q_email = Request.Form("q_email") txt_q_telephone = Request.Form("q_telephone") txt_q_fax = Request.Form("q_fax") 'Origin of Shipment txt_q_origaddress = Request.Form("q_origaddress") txt_q_origcity = Request.Form("q_origcity") txt_q_origcounty = Request.Form("q_origcounty") txt_q_origpostcode = Request.Form("q_origpostcode") txt_q_origcountry = Request.Form("q_origcountry") 'Destination txt_q_destaddress = Request.Form("q_destaddress") txt_q_destcity = Request.Form("q_destcity") txt_q_destcounty = Request.Form("q_destcounty") txt_q_destpostcode = Request.Form("q_destpostcode") txt_q_destcountry = Request.Form("q_destcountry") 'Shipment Details txt_q_commodity = Request.Form("q_commodity") txt_q_pieces = Request.Form("q_pieces") txt_q_grossweight = Request.Form("q_grossweight") txt_q_dimensions = Request.Form("q_dimensions") txt_q_declaredvalue = Request.Form("q_declaredvalue") txt_q_hazardous = Request.Form("q_hazardous") txt_q_handling = Request.Form("q_handling") txt_q_specialhandling = Request.Form("q_specialhandling") txt_q_deliveryby = Request.Form("q_deliveryby") txt_q_deliveryto = Request.Form("q_deliveryto") txt_q_insurance = Request.Form("q_insurance") txt_q_quotewithoutinsurance = Request.Form("q_quotewithoutinsurance") txt_formaction = Request.Form("formaction") %> Ocean Logistics Ltd <% IF errorMessage="" AND request.form.count <> 0 AND request.form.count <> 0 AND txt_formaction="FAX" THEN 'FAX %> <% END IF 'FAX %> <% IF errorMessage="" AND request.form.count <> 0 AND request.form.count <> 0 AND txt_formaction="FAX" THEN 'FAX %>
FAX
QUOTATION
FROM:  
COMPANY: <%=txt_q_companyname%> 
FAX: <%=txt_q_fax%> 
DATE: <%=now()%> 
Company Information
Contact: <%=txt_q_contact%>  Telephone: <%=txt_q_telephone%> 
Company Name: <%=txt_q_companyname%>  Fax: <%=txt_q_fax%> 
E-Mail: <%=txt_q_email%>     
Origin of Shipment Destination
Address: <%=txt_q_origaddress%>  Address: <%=txt_q_destaddress%> 
City: <%=txt_q_origcity%>  City: <%=txt_q_destcity%> 
County/Province/State: <%=txt_q_origcounty%>  County/Province/State: <%=txt_q_destcounty%> 
Postcode/Zip: <%=txt_q_origpostcode%>  Postcode/Zip: <%=txt_q_destpostcode%> 
Country: <%=txt_q_origcountry%>  Country: <%=txt_q_destcountry%> 
Shipment Details Terms of Delivery
Commodity: <%=txt_q_commodity%>  Transport by? <%=txt_q_deliveryby%> 
Number of pieces: <%=txt_q_pieces%>  Delivery to? <%=txt_q_deliveryto%> 
Gross Weight: <%=txt_q_grossweight%>  Require insurance? <%=txt_q_insurance%> 
Dimensions?: <%=txt_q_dimensions%>  Would like a quote? <%=txt_q_quotewithoutinsurance%> 
Declared Value: <%=txt_q_declaredvalue%>   
Hazardous: <%=txt_q_hazardous%> 
Handling instructions? <%=txt_q_handling%> 
If 'Yes', include 'Handling' Instructions:
<%=txt_q_specialhandling%> 
Notes
 
<% response.End 'EMAIL ======================================================= ELSEIF errorMessage="" AND request.form.count <> 0 AND request.form.count <> 0 AND txt_formaction="EMAIL" THEN Dim dateSent dateSent = now() 'SEND EMAIL Set mymail = Server.CreateObject("CDO.Message") mymail.To = emailto mymail.From = txt_q_email mymail.Subject = "Quotation Form (oceanlogistics.co.uk)" mymail.HTMLBody = "
Quotation form (Sent " & dateSent & ")
=========================================================
Company Information
Contact: " & txt_q_contact & "
Company Name: " & txt_q_companyname & "
E-Mail: " & txt_q_email & "
Telephone: " & txt_q_telephone & "
Fax: " & txt_q_fax & "
Origin of Shipment
Address: " & txt_q_origaddress & "
City: " & txt_q_origcity & "
County/Province/State: " & txt_q_origcounty & "
Postcode/Zip: " & txt_q_origpostcode & "
Country: " & txt_q_origcountry & "
Destination
Address: " & txt_q_destaddress & "
City: " & txt_q_destcity & "
County/Province/State: " & txt_q_destcounty & "
Postcode/Zip: " & txt_q_destpostcode & "
Country: " & txt_q_destcountry & "
Shipment Details
Commodity: " & txt_q_commodity & "
Number of pieces: " & txt_q_pieces & "
Gross Weight: " & txt_q_grossweight & "
Dimensions (if known): " & txt_q_dimensions & "
Declared Value: " & txt_q_declaredvalue & "
Hazardous: " & txt_q_hazardous & "
Special handling instructions? " & txt_q_handling & "
If 'Yes', include 'Special Handling' Instructions: " & txt_q_specialhandling & "
Terms of Delivery
Transport by? " & txt_q_deliveryby & "
Delivery to? " & txt_q_deliveryto & "
Do you require insurance? " & txt_q_insurance & "
Would like us to quote? " & txt_q_quotewithoutinsurance & "
=========================================================
" mymail.send set mymail = nothing 'EMAIL END 'EMAIL TO CUSTOMER Set mymail = Server.CreateObject("CDO.Message") mymail.To= txt_q_email mymail.From = emailfrom mymail.Subject = "Quotation Form (oceanlogistics.co.uk)" mymail.HTMLBody = "
Ocean Logistics Quotation form
=========================================================
" & txt_q_contact & ", Thank you for your enquiry. A company representative will be directly in touch with you at the address you have provided.
Regards
Ocean Logistics Ltd
=========================================================
" mymail.send set mymail = nothing 'EMAIL END 'Setting for Sent mail message emailsent = 1 'CLEAR FORM VALUES 'IF emailsent = 1 THEN END IF Response.Redirect "http://www.oceanlogistics.co.uk/processform.asp" END IF 'END >> EMAIL ======================================================= %>

Ocean Logistics Quotation Form

This online form allows you to send us information regarding your needs so that we can contact you with a quote or more information.

<% IF errorMessage<>"" THEN %>

ERROR: <%=errorMessage%>

<% ELSEIF request.form.count = 0 AND request.form.count = 0 THEN %>

Please fill in all boxes in the following form:

<% ELSE %> <% END IF %>
Company Information
Contact: />
Company Name: />
E-Mail: />
Telephone: />
Fax: />
Origin of Shipment
Address: />
City: />
County/Province/State: />
Postcode/Zip: />
Country: />
Destination
Address: />
City: />
County/Province/State: />
Postcode/Zip: />
Country: />
Shipment Details
Commodity: />
Number of pieces: />
Gross Weight: />
Dimensions (if known):
Declared Value: />
Hazardous: Yes checked="CHECKED"<%END IF%>>  No checked="CHECKED"<%END IF%>>
Special handling instructions? Yes checked="CHECKED"<%END IF%>>  No checked="CHECKED"<%END IF%>>
If 'Yes', include 'Special Handling' Instructions:
Terms of Delivery
Please check one of each of the following:
Transport by? Air checked="CHECKED"<%END IF%>>  Sea checked="CHECKED"<%END IF%>>
Delivery to? Port checked="CHECKED"<%END IF%>>  Door checked="CHECKED"<%END IF%>>
Do you require insurance? Yes checked="CHECKED"<%END IF%>>  No checked="CHECKED"<%END IF%>>
Would like us to quote? Yes checked="CHECKED"<%END IF%>>  No checked="CHECKED"<%END IF%>>

Thank you! Please now submit this quotation form directly to us via this page, or via a fax. If fax is choosen you will see a fax sheet with all the information you have provided, which you can then print.

Email checked="CHECKED"<%END IF%>> Fax checked="CHECKED"<%END IF%>>
<% END IF %>