WebWiz-Bruce wrote:
Try place the code you submit to on a second page, otherwise because the files are including the same files you will get errors like this. |
I'm sorry, but I didn't seem to have much trouble getting this code to work on a single form/results page. I write the majority of my code to all run within a single page, instead of having to have 2 pages for everything. I work on site with 100 or more pages, it's real hard to track that, let alone twice that many.
Here is a very basic layout using a copy of example.asp page as example2.asp and changed the action="example2.asp" in the <form> so that there isn't a second page involved. My page(s) that I am using it on are far more complicated that this example, so I know it will work on about any single page. The one page I am testing it in uses SQL Connections, DataSets, Error checking on the rest of the Form input as well.
<
%@LANGUAGE="VBSCRIPT" %>
<!-- Include file for CAPTCHA configuration -->
<!-- #include file="CAPTCHA/CAPTCHA_configuration.asp" -->
<!-- Include file for CAPTCHA form processing -->
<!-- #include file="CAPTCHA/CAPTCHA_process_form.asp" -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Web Wiz CAPTCHA Demo</title>
<style type="text/css">
<!--
.title {font-family: Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; }
.header {font-family: Arial, Helvetica, sans-serif; font-size: 18px; font-weight: bold; }
.text {font-size: 12px; font-family: Arial, Helvetica, sans-serif;}
.small {font-size: 10px}
body { background-color: #CCCCCC; }
-->
</style>
</head>
<body>
<div style="text-align:center;" class="header"> Web Wiz CAPTCHA <br />
<br />
</div>
<form action="example2.asp" method="post" name="form1" id="form1">
<table width="300" border="0" style="text-align:center; background-color:#000000;" cellpadding="3" cellspacing="1">
<tr>
<td style="background-color:#FFFFFF;"><table width="100%" border="0" cellspacing="1" cellpadding="3">
<tr>
<td><span class="title">Demo Form</span></td>
</tr>
<tr>
<td><span class="text">Name:</span>
<input type="text" name="name" value="<%= Request.Form("name")%>" /></td>
</tr>
<tr>
<td class="text"> Enter the code exactly as you see it in the image:-<br />
<span class="small">(Cookies must be enabled)</span><br />
<!-- include the Web Wiz CAPTCHA form -->
<!--#include file="CAPTCHA/CAPTCHA_form_inc.asp" -->
</td>
</tr>
<tr>
<td align="center"><input name="Submit Form" type="submit" id="Submit Form" value="Submit" />
</td>
</tr>
</table></td>
</tr>
</table>
</form>
<%
'If CAPTCHA is entered correctly run the following code
If Request("CAPTCHA_Postback") AND blnCAPTCHAcodeCorrect = True Then
'Place code here that is to run if CAPTCHA is entered correctly
Response.Write(request.Form("name")& ": The CAPTCHA code is correct")
'If CAPTCHA is NOT entered correctly run the following code
ElseIf Request("CAPTCHA_Postback") AND blnCAPTCHAcodeCorrect = False Then
'Place code here that is to run if CAPTCHA is NOT entered correctly
Response.Write(request.Form("name")& ": The CAPTCHA code is NOT correct")
End If
%>
</body>
</html>
Jack