Form and Submit button
I have created a basic form in DW. I would like the submit button to preform 2 actions. First email the info provided in the fields and second rediret to another page or possibly a PDF file for them to download. I am not sure exactly how to do this so any advice would be helpful. Will post code if needed. I am using ASP for a header and a footer and the backend of aour shopping cart Thanks!
Some people like to make the form handler page and the form gatherer page the same page. I hope that makes sense what I said.
Anyway, it is my opinion that the form page and the form handler page should be different scripts altogether, with client-side validation on the gathering page, and server side validation on the processing page.
Ok, so once you have these functions separated, you can have the processing page:
- Validate the info, sending the user back to the form gatherer page if needed.
- Insert the validated data into a database.
- Send an email message to the user stating that their form input has been added to the db successfully.
- redirect the user to a thank you page.
- The thank you page might have a link to the downloadable pdf file.
Seems like a lot, but I am not sure the magnitude of your problem, so I went all-out.
Here's a nice CDO link even if you don't use the attachment part because perhaps you just include an URL to the .pdf file in the e-mail:
Email (with Attachment)
I did not set up the ASP for the header, footer or shoppingcart so I don't know a whole lot about ASP. What Ubik said was way over my head, and the link BULLSchmidt sent was cool but not what I want to do.
I would like the form data emailed to me when they hit submit then the page would redirect to another page. I don't have a database setup and that is why I want everything emailed to me - Any ideas how to do this?
here's an example for you to have a look at. i've gone and put it all in one page but you can split it out if you want to go with ubik's idea.
it's quite simple really. it writes out a form for the user, the user fills it in, then an email gets sent and you get a success page. if the form input has nothing in it then it doesn't send the email and goes back to the form page.
it uses cdo as bullschmidt suggested. other ways to do this involve using 3rd party com objects.
to get this to work, save it as formmailer.asp and put your email address in the mailto bit.
if ucase(request("action")) = "SENDMAIL" then
page = sendMail()
page = "FORM"
select case ucase(page)
'function to write out form for user to fill in
<form action="formmailer.asp" method="post">
<input type="hidden" name="action" value="sendmail">
<input type="submit" value="send mail">
'function to write out success page
Thank you for your input
'function to send mail
sendMail = "FORM"
message = request("info") & ""
if message <> "" then
body = "here's the message " & chr(13) & chr(13) & message
Set myMail = CreateObject("CDO.Message")
myMail.Subject = "someone's filled in your form"
myMail.From = "email@example.com"
myMail.To = "your email address goes here"
myMail.TextBody = body
sendMail = "SUCCESS"
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)