M
Mark Creelman
Hi:
I am relatively new to ASP. I prefer Perl, but need to do this form to e-mail sipt for a web page,
See Example of script below that works fine. I want to add the feature to this where it will tell customer that they missed a field, "click
here" to go back & try again.
Does not need to be fancy telling them which field they missed. (Although would be nice) Can even require all fields to be filled out, or do again.
Currently it kicks you out when e-mail field is empty, but not on any other field.
Again..nothing fancy need be written, just the basics.
Any help would be appreciated.
Thanks,
Mark
---------------------------------------------------------------------------------
<%
On Error Resume Next
If Request.Form("send") <> "" Then
Set iConf = CreateObject ("CDO.Configuration")
Set Flds = iConf.Fields
Flds(cdoSendUsingMethod) = cdoSendUsingPort
Flds(cdoSMTPServer) = "mail.korax.net"
Flds.Update
Set iMesg = CreateObject("CDO.Message")
Set iMesg.Configuration = iConf
Err.Clear
iMesg.To = "(e-mail address removed)"
iMesg.From = Request.Form("Email")
iMesg.Subject = "Email Form"
str1 = Request.Form("Fname")
str2 = Request.Form("Lname")
str3 = Request.Form("Email")
iMesg.TextBody = str1 & " " & str2 & str3
iMesg.Send
If Err.Number = 0 Then
Result = ""
Response.Redirect "http://mydomain.com/thankyou.htm"
Else
Result = "You didn't enter your E-mail address"
End If
End If
%>
<body bgcolor="#3E71A8" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
<!--metadata type="typelib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D" name="CDO for Windows 2000 Type Library" -->
<form method=post>
<table border="0" cellspacing="0" cellpadding="2" width="581">
<td align="right" valign="middle" class="smain" width="192"><font color="red"><b>*</b></font> First: </td>
<td align="left" valign="middle" class="smain" width="119"><input type="text" name="FName" size="15" maxlength="20" tabindex="2" ID="Text1"></td>
<td align="left" valign="middle" width="1"> </td>
<td align="right" valign="middle" class="smain" width="185"><font color="red"><b>*</b></font> Last: </td>
<td align="left" valign="middle" class="smain" width="185"><input type="text" name="LName" size="15" maxlength="20" tabindex="3" ID="Text2"></td>
<td align="left" valign="middle" class="smain" width="185"><input type="text" name="Email" size="15" maxlength="20" tabindex="3" ID="Text3"></td>
</tr>
</table>
</form>
I am relatively new to ASP. I prefer Perl, but need to do this form to e-mail sipt for a web page,
See Example of script below that works fine. I want to add the feature to this where it will tell customer that they missed a field, "click
here" to go back & try again.
Does not need to be fancy telling them which field they missed. (Although would be nice) Can even require all fields to be filled out, or do again.
Currently it kicks you out when e-mail field is empty, but not on any other field.
Again..nothing fancy need be written, just the basics.
Any help would be appreciated.
Thanks,
Mark
---------------------------------------------------------------------------------
<%
On Error Resume Next
If Request.Form("send") <> "" Then
Set iConf = CreateObject ("CDO.Configuration")
Set Flds = iConf.Fields
Flds(cdoSendUsingMethod) = cdoSendUsingPort
Flds(cdoSMTPServer) = "mail.korax.net"
Flds.Update
Set iMesg = CreateObject("CDO.Message")
Set iMesg.Configuration = iConf
Err.Clear
iMesg.To = "(e-mail address removed)"
iMesg.From = Request.Form("Email")
iMesg.Subject = "Email Form"
str1 = Request.Form("Fname")
str2 = Request.Form("Lname")
str3 = Request.Form("Email")
iMesg.TextBody = str1 & " " & str2 & str3
iMesg.Send
If Err.Number = 0 Then
Result = ""
Response.Redirect "http://mydomain.com/thankyou.htm"
Else
Result = "You didn't enter your E-mail address"
End If
End If
%>
<body bgcolor="#3E71A8" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
<!--metadata type="typelib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D" name="CDO for Windows 2000 Type Library" -->
<form method=post>
<table border="0" cellspacing="0" cellpadding="2" width="581">
<td align="right" valign="middle" class="smain" width="192"><font color="red"><b>*</b></font> First: </td>
<td align="left" valign="middle" class="smain" width="119"><input type="text" name="FName" size="15" maxlength="20" tabindex="2" ID="Text1"></td>
<td align="left" valign="middle" width="1"> </td>
<td align="right" valign="middle" class="smain" width="185"><font color="red"><b>*</b></font> Last: </td>
<td align="left" valign="middle" class="smain" width="185"><input type="text" name="LName" size="15" maxlength="20" tabindex="3" ID="Text2"></td>
<td align="left" valign="middle" class="smain" width="185"><input type="text" name="Email" size="15" maxlength="20" tabindex="3" ID="Text3"></td>
</tr>
</table>
</form>