|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
From Front Page form, send to database AND email
I have created a workorder form on Front Page that employees use to send in computer and other maintenance problems. In the form properties, I can choose to send the data to a database OR send it in an email, but can not choose both. We have it going to a database so we can better manage the data. But we would also like to send an email notification when a new record is added to the database. I've tried this in Access on the database end but came up emptyhanded. The Access gurus have suggested it's something I need to do in html on the form. My html is very limited so I'm hoping someone can tell me if this is possible, and how I would go about doing it. The HTML gurus suggested it was an ASP issue.
TIA! |
|
#2
|
||||
|
||||
|
This is very doable, but not using the wizards in FrontPage. What you need to do is write a form handler page in asp. You will set the "action=" attribute of your form to the form handler .asp page. Then in that page you can write all the stuff you want to do with the form data, including emails, inserts, and the like. If you need help with this, post back.
|
|
#3
|
|||
|
|||
|
I hate bugging people for help, but I'm afraid I do need more detail on this. Also, will I need to totally re-do my form, or can I modify it?
|
|
#4
|
||||
|
||||
|
You do not have to re-do your form at all. Simply change the form "action" tag to the name of the handler asp you will write. ie, if you named your form handler "formhandler.asp", then in the form, you would put "action=formhandler.asp". That takes care of the form itself. In the form handler page, google around for information on sending email with asp and connecting to a database with asp. That should give you enough to get started. Once you have some code written, come back and we can help you troubleshoot it.
__________________
--Dave-- U2kgSG9jIExlZ2VyZSBTY2lzLCBOaW1pdW0gRXJ1ZGl0aW9uaXMgSGFiZXM= |
|
#5
|
|||
|
|||
|
Ok, you're going to think I'm a complete idiot....but what program do I even use for this? I've created everything in Front Page and I know there's a tab at the bottom for HTML view, but I don't see anything for asp.
![]() |
|
#6
|
||||
|
||||
|
You can write asp code in the html view of Frontpage, just be sure to save the files with the .asp extension. Also, if you haven't used asp on your server before, be sure that it is installed on the server.
|
|
#7
|
|||
|
|||
|
I did some searching and I think I found the asp code that I need to add. See if this looks right:
<% Set Mail=Server.CreateObject("CDONTS.NewMail") Mail.to="me@myaddress.com" Mail.From="root@myaddress.com" Mail.Subject="New Workorder" Mail.Body="A new workorder has been submitted." Mail.Send Set Mail=nothing %> Now my problem is I have NO idea where to put it in with all the html code. The data is currently sent to a database using the Form Properties in Front Page, and I see it in the html way up at the top of the <form section. Here is the part of html where my submit button is. I may have included too much because I'm not sure where one thing ends and another begins: <p align="center"> </p> <p align="center"><input type="submit" value="Submit Workorder" name="B1"> <input type="reset" value="Clear All Fields" name="B2"></p> </form> Is this enough information? I can post the entire form section of code if I need to. |
|
#8
|
||||
|
||||
|
You can add that code anywhere on the page. ASP is processed first on the server, before any of the html, so it doesn't matter where you put it.
For future ease of use, though, you might want to take my earlier suggestion and make a form handler page with your asp code in it, rather than putting it all in one page. |
|
#9
|
|||
|
|||
|
I'll have to look into that! I tried doing a search on form handler and wasn't really clear on it, so it'll have to be a future thing. Thanks very much for all your help!
|
|
#10
|
||||
|
||||
|
No problem. I'll try to explain the form handler thing again here, in case you get around to it.
When you made your form, in the first <form> tag, you have the "action" attribute (among others). To do what I suggested, if you had a form named "Fred", you would create a new asp page named "fredhandler.asp" or something. Then, in your "Fred" form, you would make the "action" attribute "action=fredhandler.asp" (assuming they are in the same directory. Then you just make a regular submit button. In your "fredhandler.asp" page, you would put all your asp code, telling what to do with the data from the form, which you can use directly with "request.form("formfieldname")" or put into variables (recommended) and use that way. The handler is preferable because it makes both pages easier to read, and makes it trivial to add more things to do with your form data. Good luck with your project. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > From Front Page form, send to database AND email |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|