Forum Moderators: open
[code]
<%
name = request.form("name")
email = request.form("email")
message = request.form("message")
If name="" or email="" or message="" Then
url = "contact.asp?reqd=* indicates required field&name=" & name & "&email=" & email & "&message=" & message
If name="" Then
url = url & "&mname=*"
End if
If email="" Then
url = url & "&memail=*"
End if
If message="" Then
url = url & "&mmessage=*"
End if
response.redirect url & "&foobar=foobar#form"
response.end
End if
Dim objCDONTS ' Email object
Dim strFromName ' From persons' real name
Dim strFromEmail, strToEmail ' Email addresses
Dim strSubject, strBody ' Message
Dim misccompo
strSubject = "dcs"
strFromName = Trim(Request.Form("name"))
strFromEmail = Trim(Request.Form("email"))
strToEmail = "mark@dcs-imago.com"
strBody = Trim(Request.Form("message"))
Set objCDONTS = Server.CreateObject("CDONTS.NewMail")
objCDONTS.From = strFromName & " <" & strFromEmail & ">"
objCDONTS.To = strToEmail
objCDONTS.Subject = strSubject
objCDONTS.Body = "--------------------------------------" & vbcrlf & vbcrlf & strbody & vbcrlf & vbcrlf & vbcrlf & "--------------------------------------------------------------" & vbcrlf & "MESSAGE ENDS: End of message"
objCDONTS.Send
Set objCDONTS = Nothing
response.redirect "thanks.asp"
response.end
%>
[/code]
<%
dim contactName, contactEmail, contactMessage, isSubmitted, nameRequired, EmailRequired
isSubmitted = request.form("the_name_of_your_submit_button")
If isSubmitted <> "the_label_of_your_submit_button" Then
contactName = ""
contactEmail = ""
contactMessage = ""
nameRequired =""
emailRequired =""
Else
contactName = request.form("name")
contactEmail = request.form("email")
contactMessage = request.form("message")
End If
If contactName="" or contactEmail="" then
nameRequired = "Please enter your name"
emailRequired = "Please enter your Email"
Else
Dim objCDONTS ' Email object
Dim strFromName ' From persons' real name
Dim strFromEmail, strToEmail ' Email addresses
Dim strSubject, strBody ' Message
Dim misccompo
Set objCDONTS = Server.CreateObject("CDONTS.NewMail")
objCDONTS.From = contactName & " <" & contactEmail & ">"
objCDONTS.To = "mark@dcs-imago.com"
objCDONTS.Subject = "dcs"
objCDONTS.Body = "--------------------------------------" & vbcrlf & vbcrlf & contactMessage & vbcrlf & vbcrlf & vbcrlf & "--------------------------------------------------------------" & vbcrlf & "MESSAGE ENDS: End of message"
objCDONTS.Send
Set objCDONTS = Nothing
response.redirect "thanks.asp"
response.end
end if
%>
and in your html body
<table width="420" border="0" cellspacing="0" cellpadding="0">
<form name="contact" method="post" action="contact.asp">
<tr>
<td width="150">Name</td>
<td width="150">
<input type="text" name="name" value="<%=contactName%>">
</td>
<td><%=nameRequiredMessage%></td>
</tr>
<tr>
<td width="150">Email</td>
<td width="150">
<input type="text" name="email" value="<%=contactEmail%>">
</td>
<td><%=EmailRequiredMessage%></td>
</tr>
<tr>
<td width="150">Comment</td>
<td width="150">
<textarea name="comment"><%=contactMessage%></textarea>
</td>
<td> </td>
</tr>
<tr>
<td width="150"> </td>
<td width="150">
<input type="submit" name="Submit" value="Submit">
<input type="reset" name="reset" value="Reset">
</td>
<td> </td>
</tr>
</form>
</table>
Hope I didnt' make mistakes ;) Let me know if it works
Leo
Just copy and paste it ;)
Leo
<%
dim contactName, contactEmail, contactMessage, isSubmitted, nameRequired, EmailRequired
isSubmitted = request.form("submit")
If isSubmitted <> "isSubmit" Then
contactName = ""
contactEmail = ""
contactMessage = ""
nameRequiredMessage =""
EmailRequiredMessage =""
Else
contactName = request.form("name")
contactEmail = request.form("email")
contactMessage = request.form("message")
End If
if contactName="" then
nameRequiredMessage = "Please enter your Name"
end if
if contactEmail="" then
EmailRequiredMessage = "Please enter your Email"
end if
If contactName<>"" and contactEmail<>"" then
Dim objCDONTS ' Email object
Dim strSubject, strBody ' Message
Dim misccompo
Set objCDONTS = Server.CreateObject("CDONTS.NewMail")
objCDONTS.From = contactName & " <" & contactEmail & ">"
objCDONTS.To = "mark@dcs-imago.com"
objCDONTS.Subject = "dcs"
objCDONTS.Body = "--------------------------------------" & vbcrlf & vbcrlf & contactMessage & vbcrlf & vbcrlf & vbcrlf & "--------------------------------------------------------------" & vbcrlf & "MESSAGE ENDS: End of message"
objCDONTS.Send
Set objCDONTS = Nothing
response.redirect "thanks.asp"
response.end
end if
%>
%>
<html>
<body>
<table width="499" border="0" cellspacing="0" cellpadding="0">
<form name="contact" method="post" action="contact.asp">
<tr>
<td width="150">Name</td>
<td width="150">
<input type="text" name="name" value="<%=contactName%>">
</td>
<td width="199"><font face="Arial, Helvetica, sans-serif" size="1"><%=nameRequiredMessage%></font></td>
</tr>
<tr>
<td width="150">Email</td>
<td width="150">
<input type="text" name="email" value="<%=contactEmail%>">
</td>
<td width="199"><font face="Arial, Helvetica, sans-serif" size="1"><%=EmailRequiredMessage%></font></td>
</tr>
<tr>
<td width="150">Comment</td>
<td width="150">
<textarea name="message"><%=contactMessage%></textarea>
</td>
<td width="199"> </td>
</tr>
<tr>
<td width="150"> </td>
<td width="150">
<input type="submit" name="Submit" value="isSubmit">
<input type="reset" name="reset" value="Reset">
</td>
<td width="199"> </td>
</tr>
</form>
</table>
</body>
</html>
Googly
Cheers
Googly