<%
If Not Request.QueryString("Message") = "True" Then
'No information has been input yet, so provide the form.
%>
<%
Else
'The HIDDEN button above sets the Message variable to True.
'We know now that form data has been entered.
'Get the data from the form. We will be inserting it into the database.
'Access doesn't like some characters, such as single-quotes, so encode the
' data using the HTMLEncode method of the ASP Server object.
dim strTB1, strTB2, strTB3, strTB4, strMB1, strTB5, strTB6, strTB7, strCommand
strTB1 = Server.HTMLEncode(Request.QueryString("From"))
strTB2 = Server.HTMLEncode(Request.QueryString("EMailAdd"))
strTB3 = Server.HTMLEncode(Request.QueryString("Phone"))
strTB4 = Server.HTMLEncode(Request.QueryString("Address"))
strMB1 = Server.HTMLEncode(Request.QueryString("Memo"))
strTB5 = Server.HTMLEncode(Request.QueryString("Test"))
strTB6 = Server.HTMLEncode(Request.QueryString("City"))
strTB7 = Server.HTMLEncode(Request.QueryString("country"))
strTB8 = Server.HTMLEncode(Request.QueryString("In"))
strTB9 = Server.HTMLEncode(Request.QueryString("Out"))
strTB10 = Server.HTMLEncode(Request.QueryString("Room"))
'This is a connection string. ADO uses it to connect to a database through the Access driver.
'It needs the provider name of the Access driver and the name of the Access database.
'Connection strings are slightly different, depending on the provider being used,
' but they all use semicolons to separate variables.
'If this line causes and error, search in your registry for
' Microsoft.JET to see if 4.0 is your version.
strProvider = "Provider=Microsoft.JET.OLEDB.4.0;Data Source=E:\HostingSpaces\haridarshanresort\haridarshanresort.com\wwwroot\query.mdb;"
'This creates an instance of an ADO Connection object.
'There are 4 other ADO objects available to you, each with different methods and
'properties that allow you to do almost anything with database data.
Set objConn = server.createobject("ADODB.Connection")
'The Open method of the Connection object uses the connection string to
' create a connection to the database.
objConn.Open strProvider
'Define the query.
'There are many types of queries, allowing you to add, remove, or get data.
'This query will add your data into the database, using the INSERT INTO key words.
'Here, Enquiry Form is the name of the table.
'You need single-quotes around strings here.
' strCommand = "INSERT INTO enquiry (FTB1,FTB2,FTB3,FTB4,FMB1,FTB5,FTB6,FTB7,FTB8,FTB9,FTB10) VALUES ('"
' strCommand = strCommand & strTB1 & "','" & strTB2 & "','" & strTB3 & "','" & strTB4 & "','" & strMB1 & "','" & strTB5 & "','" & strTB6 & "','" & strTB7 & "','" & strTB8 & "','" & strTB9 & "','" & strTB10
' strCommand = strCommand & "')"
'Execute the query to add the data to the database.
' objConn.Execute strCommand
sMsg="
"
sMsg=sMsg&"
"
If strTB1 <> "" Then
sMsg=sMsg&"
Name
"
sMsg=sMsg&"
:
"
sMsg=sMsg&"
"& strTB1&"
"
End If
If strTB2 <> "" Then
sMsg=sMsg&"
Email_id
"
sMsg=sMsg&"
:
"
sMsg=sMsg&"
"& strTB2 &"
"
End If
If strTB4 <> "" Then
sMsg=sMsg&"
Address
"
sMsg=sMsg&"
:
"
sMsg=sMsg&"
"& strTB4&"
"
End If
If strTB3<> "" Then
sMsg=sMsg&"
Phone_no
"
sMsg=sMsg&"
:
"
sMsg=sMsg&"
"& strTB3&"
"
End If
If strTB6<> "" Then
sMsg=sMsg&"
City
"
sMsg=sMsg&"
:
"
sMsg=sMsg&"
"& strTB6&"
"
End If
If strTB7<> "" Then
sMsg=sMsg&"
Country
"
sMsg=sMsg&"
:
"
sMsg=sMsg&"
"& strTB7&"
"
End If
If strTB8<> "" Then
sMsg=sMsg&"
Check in date
"
sMsg=sMsg&"
:
"
sMsg=sMsg&"
"& strTB8&"
"
End If
If strTB9<> "" Then
sMsg=sMsg&"
Check out date
"
sMsg=sMsg&"
:
"
sMsg=sMsg&"
"& strTB9&"
"
End If
If strTB10<> "" Then
sMsg=sMsg&"
No of Rooms
"
sMsg=sMsg&"
:
"
sMsg=sMsg&"
"& strTB10&"
"
End If
If strTB5<> "" Then
sMsg=sMsg&"
Room Type
"
sMsg=sMsg&"
:
"
sMsg=sMsg&"
"& strTB5&"
"
End If
If strMB1 <> "" Then
sMsg=sMsg&"
Feedback/ Query
"
sMsg=sMsg&"
:
"
sMsg=sMsg&"
"&strMB1 &"
"
End If
sMsg=sMsg&"
"
sMsg=sMsg&"
"
'response.write(smsg)
sch = "http://schemas.microsoft.com/cdo/configuration/"
Set cdoConfig = Server.CreateObject("CDO.Configuration")
Const cdoBasic = 1
cdoConfig.Fields.Item(sch & "smtpserver") = "localhost"
cdoConfig.fields.update
Set cdoMessage = Server.CreateObject("CDO.Message")
Set cdoMessage.Configuration = cdoConfig
CDOMESSAGE.FROM = strTB2
cdoMessage.To = "haridarshanresort@gmail.com"
cdoMessage.Bcc = "meshcreation@gmail.com"
cdoMessage.Subject = "Holistic Himalayas Enquiry Request by "&strTB1
CDOMESSAGE.HTMLBody = sMsg
cdoMessage.Send
Set cdoMessage = Nothing
Set cdoConfig = Nothing
Response.Write("Thank you! for wriiting in, Haridarshan Resortwill reply you shortly.")
End If
%>