codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Form Email script  Solace at 22:45 on Sunday, September 14, 2003
 

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.

  Re: Form Email script  Troy Wolf at 04:44 on Tuesday, September 16, 2003
 

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.
Troy Wolf: site expert
SnippetEdit Website Editor


  Re: Form Email script  Solace at 02:12 on Thursday, September 18, 2003
 

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.

  Re: Form Email script  Elain at 07:33 on Wednesday, November 17, 2010
 

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|








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Re: hi
•  Re: Questions about Bill Gates
•  Re: How to convert a big XML to HTML using XSL?
•  Re: Assign a html table element to a variable
•  Re: Form Field Validation
•  Re: Form Email script
•  Re: File Formats
•  Re: Cannot Input data to Database Access
•  Re: Help me


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2010