/    Sign up×
Community /Pin to ProfileBookmark

Can form data be submitted to database and email?

I am very unfamiliar with JavaScript, and I need to have a form submit to two places. We have a back-end database that loads all the information in the form, but I also need to have it send an email to the person who will be answering inquiries. Is it possible to send form information to two places? I am currently using the action=”name.asp” to submit the form to the database.

Help?

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@konithomimoMar 21.2006 — yes and no . . . javascript is not good for accessing databases, nor can it email a form, but it can easily be used to send an email with form data. The best thing to do is use a server-side script such as PHP/ASP which can do both very easily. Javascript is more client-side.

From what you have said, it seems that you are using ASP to send the info to the database, so what you really want is to send the info to that page/script. That is easy enough. All that you need to do is send the info, either by way of the query string, which is suggest, or by using a cookie. Then for the email just try this:

<form action="mailto:[email protected]" method="post" enctype="text/plain" >
FirstName:<input type="text" name="FirstName">
Email:<input type="text" name="Email">
<input type="submit" name="submit" value="Submit">
</form>
Copy linkTweet thisAlerts:
@prelwebauthorMar 21.2006 — Thank you, Konithomino,

I apologize, I am using .asp not JavaScript for this.

I added the code you suggested, and it did send me an email. Unfortunately, it didn't post to the database. Here is the link to the form.

[URL=http://www.pacificcompcenter.org/contact.asp]http://www.pacificcompcenter.org/contact.asp[/URL]

This particular one does not have the code you gave me, because it is on the live server. Unfortunately, no one outside our company can access the staging server. However, you should be able to see the code that I am using. I changed the action="" from contact.asp to mailto:email and added the enctype value also. As I said, on the staging version I am using, it sends me an email but does not post to the database.

I truly appreciate any and all help. Thank you!

Rayna
×

Success!

Help @prelweb spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...