Hello
I have the following code on form.asp which checks that all fields in the form have been completed. The code works.
<%
If Request.Form.Count > 0 Then
Name = Trim(Request.Form("t1"
)
Email = Trim(Request.Form("t2"
)
Message = Request.Form("S1"
'data validation
If Name = "" Then
ErrorMsg = ErrorMsg & "Please enter your name<br>"
End If
If Email = "" Then
ErrorMsg = ErrorMsg & "Please enter your email address<br>"
End If
If Message = "" Then
ErrorMsg = ErrorMsg & "Please write your message<br>"
End If
If ErrorMsg = "" Then
'when the name, email and message fields have been checked, redirect the visitor
Response.Redirect "whatever.asp"
End If
End If
%>
<form action="<%= Request.ServerVariables("SCRIPT_NAME"
%>" method=post>
<% If ErrorMsg <> "" Then %>
<p><font color="#FFFFFF"><b><%= ErrorMsg %></b></font><p>
<% End If %>
<input type=text name="t1" value="<%= t1 %>">
<input type=text name="t2" value="<%= t2 %>">
<textarea name="S1" cols="20" rows="3" value="<%= S1 %>"></textarea></font>
Any error messages appear on the same page (form.asp). When all fields have been completed correctly, the page redirects to whatever.asp:
Response.Redirect "whatever.asp"
Using the same variables as above (namely "t1"
, I would now like to thank "t1" (name) for submiting the form. The thank you message should appear on whatever.asp.
Can anybody on the forum, please indicate how I might do that? That is, how can I combine the two functions?
Many thanks
LaPluma
I have the following code on form.asp which checks that all fields in the form have been completed. The code works.
<%
If Request.Form.Count > 0 Then
Name = Trim(Request.Form("t1"
Email = Trim(Request.Form("t2"
Message = Request.Form("S1"
'data validation
If Name = "" Then
ErrorMsg = ErrorMsg & "Please enter your name<br>"
End If
If Email = "" Then
ErrorMsg = ErrorMsg & "Please enter your email address<br>"
End If
If Message = "" Then
ErrorMsg = ErrorMsg & "Please write your message<br>"
End If
If ErrorMsg = "" Then
'when the name, email and message fields have been checked, redirect the visitor
Response.Redirect "whatever.asp"
End If
End If
%>
<form action="<%= Request.ServerVariables("SCRIPT_NAME"
<% If ErrorMsg <> "" Then %>
<p><font color="#FFFFFF"><b><%= ErrorMsg %></b></font><p>
<% End If %>
<input type=text name="t1" value="<%= t1 %>">
<input type=text name="t2" value="<%= t2 %>">
<textarea name="S1" cols="20" rows="3" value="<%= S1 %>"></textarea></font>
Any error messages appear on the same page (form.asp). When all fields have been completed correctly, the page redirects to whatever.asp:
Response.Redirect "whatever.asp"
Using the same variables as above (namely "t1"
Can anybody on the forum, please indicate how I might do that? That is, how can I combine the two functions?
Many thanks
LaPluma