asp contact us form

Soldato
Joined
2 Oct 2004
Posts
4,362
Location
N.W London
Hi there,

This is the asp contact form source code I need to setup a contact form

Trouble is when I click on the submit button I get a page full of code instead of the error.html page appearing advising user to go back and complete required fields on my form

Where am I going wrong?

Thanks

<%

Dim error
error = 0
For Each f In Request.Form
If Request.Form(f) = "" Then
error = 1
End If
Next
If error=1 Then
response.redirect "error.html"
Else
Dim f, emsg, mail_to, r, o, c, other
mail_to = "[email protected]"
fline = "_______________________________________________________________________"& vbNewLine
hline = vbNewLine & "_____________________________________"& vbNewLine
emsg = ""

For Each f In Request.Form
If mid(f,1,1)<>"S" = True Then 'do not save if input name starts with S
emsg = emsg & f & " = " & Trim(Request.Form(f)) & hline
End If
Next

Set objNewMail = Server.CreateObject("CDONTS.NewMail")
objNewMail.From = Request("Email Address")
objNewMail.Subject = "Message from contact page (version: 1.0)"
objNewMail.To = mail_to
objNewMail.Body = emsg & fline
objNewMail.Send
Set objNewMail = Nothing

response.redirect "thankyou.html"
End if
%>
 
Page full of code indicates your host doesn't support ASP or you've named your file wrong,

Is the file named say contact.asp, not contact.htm?
 
This is the .html form called quotes.html

The above is the .asp code called "contactusprocess.asp"

<form action="contactusprocess.asp" method="post" enctype="multipart/form-data" name="Quotes_Form" id="Quotes_Form">
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Pickup Date
<input name="Date" type="text" id="Date" onblur="MM_validateForm('Date','','R','time','','R','Name2','','R','Phone','','RisNum','email','','RisEmail','Pickup','','R','Dropoff','','R','Pax','','R','vehicle ','','R');return document.MM_returnValue" size="12" maxlength="12" />
Pickup Time
<input name="time" type="text" id="time" size="12" maxlength="12" />
</p>
<p>Name:
<input name="Name" type="text" id="Name" size="20" maxlength="20" />
Mobile Number:
<input name="Phone" type="text" id="Phone" size="15" maxlength="15" />
</p>
<p>Email Address:
<input name="email" type="text" id="email" size="40" maxlength="60" />
</p>
<p>Pickup From (Inc Postcode):
<input name="Pickup" type="text" id="Pickup" size="35" maxlength="40" />
</p>
<p>Drop Off (Inc Postcode):
<input name="Dropoff" type="text" id="Dropoff" size="35" maxlength="40" />
</p>
<p>Flight Number:
<input name="Flight_Number" type="text" id="Flight_Number" size="10" maxlength="10" />
Total No. Of Passengers:
<input name="Pax" type="text" id="Pax" size="5" maxlength="20" />
</p>
<p>
No. Checked In Luggages:
<input name="luggages" type="text" id="luggages" size="8" maxlength="50" />
Vehicle Type:
<input name="vehicle " type="text" id="vehicle " size="8" maxlength="15" />
</p>
<p>Comments:
<input name="Comments" type="text" id="Comments" value="Any additional requests to be entered here" size="55" />
</p>
<p align="center">
<input type="submit" name="Submit" id="Submit" value="Request Quote" />
</p>
</form>

to answer your question the file is definately named - contactusprocess.asp

my host definately supports .asp as I barely know the basics

the .asp code above is borrowed from the internet :)
 
Last edited:
Page full of code indicates your host doesn't support ASP
This is the most likely culprit then.

Does the 'page of code' exactly match your .asp file? If so then the code is not being processed correctly by your server and you'll most likely need to have a chat with your hosting co.

It could be that they support ASP, but have not enabled it on your account. Or perhaps they thought you meant ASP.Net, which is completely different.
 
yes you guys were correct thanks for that

the host is clicking a few switches for me to allow asp

thanks for that

so now if i use the above code does that mean everything will be work? is that .asp code above correct?

thanks for all your help
 
Back
Top Bottom