WebSite feedback form using CDOSYS in ASP

We can develop a script to collect the details of a feedback form ( or contact us form ) and post the visitor input details to site administrator. The form part is simple one form with input text boxes for the users to post name, email, address with a textbox to collect detail feedback. This form will submit all these details by using POST method and the ASP script will use the CDOSYS to send the mail. Before this we have to format the mail body. Here is the code for to display HTML feedback form in ASP

<%
Response.Write " <form method=post action=feedback2.asp> "&_
"<table class='t2'>"&_
"<tr><td colspan=2>Feedback Form</td></tr>"&_
"<tr><td>Name</td><td><input type=text name=fname></td></tr>"&_
"<tr><td>Email</td><td><input type=text name=email></td></tr>"&_
"<tr><td>Address 1</td><td><input type=text name=add1></td></tr>"&_
"<tr><td>Address 2</td><td><input type=text name=add2></td></tr>"&_
"<tr><td>City</td><td><input type=text name=city></td></tr>"&_
"<tr><td>State</td><td><input type=text name=state></td></tr>"&_
"<tr><td>Country</td><td><input type=text name=country></td></tr>"&_
"<tr><td colspan=2>Details</td></tr>"&_
"<tr><td colspan=2><textarea name=t1 rows=5 cols=40></textarea></td></tr>"&_
"<tr><td colspan=2><input type=submit value=Submit></td></tr>"&_
"</table></form>"
%>

These form data will be collected and posted to site admin by CDOSYS. Here is the code for feedback2.asp page .

<%
Dim fname,email,add1,add2,city,state,country,t1,body_text
fname=Request("fname")
email=Request("email")
add1=Request("add1")
add2=Request("add2")
city=Request("city")
state=Request("state")
country=Request("country")
t1=Request("t1")

body_text="Name = "& fname & "<br>"
body_text = body_text + "Email = "& email & "<br>"
body_text = body_text + "Address 1 = "& add1 & "<br>"
body_text = body_text + "Address 2 = "& add2 & "<br>"
body_text = body_text + "City = "& city & "<br>"
body_text = body_text + "State = "& state & "<br>"
body_text = body_text + "Country = "& country & "<br>"
body_text = body_text + "Details = "& t1 & "<br>"

Set plusMail=CreateObject("CDO.Message")
plusMail.Subject="Feedback from plus2net.net"
plusMail.From=email
plusMail.To="siteadmin@sitename.com"
plusMail.HtmlBody=body_text
plusMail.Send
set plusMail=nothing


Response.Write "Your feedback posted "


Be the first to post comment on this article :

plus2net.com




Post your comments , suggestion , error , requirements etc here .




We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer