2 Form/ASP questions
Author
Discussion

Nic Jones

Original Poster:

7,190 posts

252 months

Thursday 1st November 2007
quotequote all
Being a bit of a novice to web design I have 2 quick questions if you'd be so kind guys:-

website form question 1 said:
<table>
<form action="testform.asp" method="post" >
<tr><td colspan="2">
<% If FormErrorsString = " ConnectionError " Then
response.write "<font color=red>There is currently a problem with connecting to the database. Please try again later.</font>"
Else
response.write "Please enter your details here:"
End If
%></td>
</tr>

<tr>
<td>Full Name:</td>
<td><%
If InStr(FormErrorsString, "$1$" ) Then
'display image
Response.Write "<IMG SRC=""rejected.gif"" BORDER=""0"">"
End If
%></td>
<td><input name="strname" value="<%request("strname" )%> " SIZE=50> </td>
<td><%
If InStr(FormErrorsString, "$1$" ) Then
'display image
Response.Write "<h5 style=""color:red"">There is an error in this field, please rectify and submit again</h5>"
End If
%></td>
</tr>

'---------------------------

<%
Function ConfirmationEmail()

dim objemail
set objemail = Server.CreateObject("CDO.Message" )
objemail.From = "test_test@testwebsite"
objemail.To = request("stremailadd" )
objemail.Cc = ";" & "nicholas.jones@xxxxxx.net"
objemail.Subject = "test Confirmation"
objemail.HTMLBody = "Thank you for submitting your details regarding the xxxxxxx with us."
objemail.Send
set objemail = Nothing

End Function
%>
The form is submitted to a database, once submitted I need it to send out an email to the person who has submitted (stremailadd) this works, I also however need to include in the same email the information the user submitted.

I've tried putting:-
objemail.HTMLBody = "Thank you for submitting your details regarding the xxxxxxx with us."
objemail.HTMLBody = request("strname" )
objemail.HTMLBody = request("stremailadd" )

etc....

But it doesn't seem to work, any pointers would be lovely.


website form question 2 said:
<tr>
<td>Email Address:</td>
<td><%
If InStr(FormErrorsString, "$2$" ) Then
'display image
Response.Write "<IMG SRC=""rejected.gif"" BORDER=""0"">"
End If
%></td>
<td><input name="stremailadd" value="<% If request("stremailadd" ) <> "" and InStr(request("stremailadd" ), "@xxxxx.net" ) >3 Then
response.write("stremailadd" )
End If %>@xxxxx.net" SIZE=50>
</td>

<td><%
If InStr(FormErrorsString, "$2$" ) Then
'display image
Response.Write "<h5 style=""color:red"">There is an error in this field, please rectify and submit again</h5>"
End If
%></td>

</tr>
I also have set up the form so in the email address form field it permanently has "@xxxxx.net" in it, the problem comes that when I submit and the validation script runs I want it to put the users email address back in the form field without adding another "@xxxxx.net" I can't quite get it to work, at the moment it returns the form with "stremailadd@xxxxx.net" which obviously isn't right.
Again, I can't see what to change to make it return the users email address.

Thanks, I'm tearing my hair out now!



Edit to remove &quotewink smiley annoying things!


Edited by Nic Jones on Thursday 1st November 20:22