3) Creating the form.
Time to create the form! We will create a simple form that collects the string from the user and submits it back to the same page. Create a page called 'default.asp' (as in future, we want this page to be the default page of this directory) and insert the below code in it:
Code:
<%@Language=VBScript%>
<% Option Explicit %>
<!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>Word Verification</title>
</head>
<body>
<form id="frmWord" name="frmWord" method="post" action="default.asp">
Â* Â* Enter the text in the image above.<br />
Â* Â* <input name="txtWord" type="text" />
Â* Â* <br />
Â* Â* <br />
Â* Â* <input type="submit" name="Submit" value="Submit" />
</form>
</body>
</html>
Quite simple code, nothing unusual here. Try entering some string and submitting the form. You will be returned to the same page.
Now we will ‘insert’ the image generated by our ‘genImage.asp’ in this form. Add the below code right after the <body> tag.
Code:
<%
Response.Write("<img src=" & Chr(34) & "genImage.asp" & Chr(34) & "/>")
%>
<br />
<br />
As you can see we are using the ASP page as the image itself. But will it work? Save the file and find out for yourself. You should get results as below:
Check your code here:
default.asp