 |
|
|
| View previous topic :: View next topic |
| Author |
Message |
martinscott
Joined: 13 Jul 2009 Posts: 3
|
Posted: Mon Jul 13, 2009 5:19 am ASP Field Validation |
|
|
|
Hey Guys,
Any and all help would be greatly appreciated.
Here is a simple ASP script that collects information and sends an e-mail. There is only one problem. People can just submit a blank one. I have searched around the internet and cannot find any helpful tutorials on this. What I am needing to do is juat make it so that something must be entered in each field. Not anything complex at all, just so that it cannot be blank. One again, any and help would be appreciated. Here is the code:
<%
Dim UsableDate
UsableDate = WeekDayName(WeekDay(Date), true) & ", " & Day(Date) & " " & MonthName(Month(Date), true) & " " & Year(Date) & " " & FormatDateTime(DateAdd("h", 2, now), 4) & " (CST)"
Name = Request.Form("name")
UserEmail = Request.Form("email")
Company = Request.Form("Company")
Street = Request.Form("Street")
Street2 = Request.Form("Street2")
City = Request.Form("City")
State = Request.Form("State")
Zip = Request.Form("Zip")
Phone = Request.Form("phone")
Fax = Request.Form("fax")
Comments = Request.Form("comments")
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.RemoteHost = "mail.fakewebsite.com"
Mailer.AddRecipient "Sales", "mthomasatfakewebsite.com"
Mailer.FromName = "Online Brochure Request"
Mailer.FromAddress = "do_not_replyatfakewebsite.com"
Mailer.Subject = "Brochure Request"
Mailer.DateTime = UsableDate
If IsEmpty(UserEmail) or IsNull(UserEmail) or UserEmail="" then
Else
Mailer.ReplyTo = UserEmail
End If
Mailer.BodyText = "Date: " & UsableDate &_
VbCrLf &_
VbCrLf & "Name: " & Name &_
VbCrLf & "Company: " & Company &_
VbCrLf & "Email: " & Useremail &_
VbCrLf & "Phone: " & Phone &_
VbCrLf & "Fax: " & Fax &_
VbCrLf & "Street: " & Street &_
VbCrLf & "Street: " & Street2 &_
VbCrLf & "City: " & City &_
VbCrLf & "State: " & State &_
VbCrLf & "Zip: " & Zip &_
VbCrLf & "Comments: " & Comments &_
VbCrLf
'sends mail...required
if Mailer.SendMail then
Response.Redirect "http://www.fakewebsite.com/confirmation.html"
else
Response.Write "Mail send failure. Error was " & Mailer.Response
end if
%>
Thanks,
online seo training |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|
|
 |
|
|
|
|
|
|
|