|
Hello all, I hope you dont mind me asking what will seem a stupid question, but this is my first go at this. I am looking for a simple ASP script and the accompanying HTML code that will allow me to have a text field where a user can input a question or comment and hit the submit button and the content will be sent to my email address. After the user hits submit I want a thank you page to come up and then redirect back to the form page. I have tried numerous scripts but have yet to figure out a way to get it working correctly. Thanks so much for your help.
|
|
|
Do you have the ASPemail component on your IIS server? If not, can you get it and install it? There is a free version. http://www.aspemail.com
This is probably the most popular email component for ASP. If you cannot use this, then you are "stuck" with CDONTS.
Here is a general page template that I use for pages that display a form, then process that form.
<%
if Request.Form.Count > 0 then
'Get form variables here
firstName = Request.Form("firstName")
comments = Request.Form("comments")
call SendEmail()
call ShowThankyou()
else
call ShowForm()
end if
'------------------------------------------
function SendEmail()
'------------------------------------------
'Do your email sending thing here
end function 'SendEmail
'------------------------------------------
function ShowThankyou()
'------------------------------------------
%>
<html>
<head>
</head>
<body>
Thanks for submitting the form!
</body>
</html>
<%
end function 'ShowThankyou
'------------------------------------------
function ShowForm()
'------------------------------------------
%>
<html>
<head>
</head>
<body>
<form method=post action=MyForm.asp>
Name: <input type=text name=firstName><br>
Comments: <textarea name=comments cols=50 rows=5></textarea><br>
<input type=submit>
</form>
</body>
</html>
<%
end function 'ShowForm
|
|
Hopefully this helps you understand a basic page structure to handle first showing the blank form, then processing that form, then sending back a thank you page all in one asp file. I know many people are confused about how to do this at first.
|
|
|
|
|
Thanks for your help Troy. Ive come to the conclusion that I need to call Hostway because I think the problem is on their end. I have tried so many scripts its ridiculous. Thanks again, and hopefully once I get the server situated I can use your script successfully.
|
|
|
I used the same way, but i can't solve the problom, who can tell me how should i do?
------------------------------------------- flash banner|logo maker|flash menu|
|
|
|
|
|
|
|
|