The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> HTML Forms submit to email
pong22
post Nov 27 2009, 07:22 AM
Post #1





Group: Members
Posts: 6
Joined: 27-November 09
Member No.: 10,452



Hello I am in desperate need of some help. I am building a form for my website for clients to fill out so we can contact them if they want to recieve more information. The form looks great however when i test it out by filling in data and clicking "submit" no data gets sent to my email. Heres is the coding I am using. Please help as I am a novice in HTML. I would love all the info they fill out in the "contact form" to be sent to my email. Thank you!

<form id="contacts-form" action="mailto:my_email@my_email.com">
<fieldset>
<div class="field"><label>Full Name:</label><input type="text" value=""/></div>
<div class="field"><label>E-mail:</label><input type="text" value=""/></div>
<div class="field"><label>Law Firm:</label><input type="text" value=""/></div>
<div class="field"><label>Address:</label><input type="text" value=""/></div>
<div class="field"><label>City:</label><input type="text" value=""/></div>
<div class="field"><label>State:</label><input type="text" value=""/></div>
<div class="field"><label>Phone:</label><input type="text" value=""/></div>
<div class="field"><label>Message:</label><textarea cols="" rows=""></textarea></div>
<div class="alignright"><a href="" class="button" onclick="('contacts-form').submit()"><em><b>Submit</b></em></a></div>
</fieldset>
</form>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Nov 27 2009, 07:57 AM
Post #2


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,716
Joined: 9-August 06
Member No.: 6



'mailtro' is unreliable in the first place.
http://www.htmlhelp.com/faq/html/forms.html#mailto-form

Making the form rely on JavaScript doesn't make it better. How did you come up with the below?
CODE
onclick="('contacts-form').submit()"


Something like so should work. Maybe that's what the above originally was and then a part got lost.
CODE
onclick="document.getElementById('contacts-form').submit()"


But it would be much better to use a real submit button and ditch the JS. Style it to look like a link if that's important. Your form also needs method="post" and enctype="text/plain" in the FORM tag and the inputs should have names.
http://htmlhelp.com/reference/html40/forms/input.html
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pong22
post Nov 27 2009, 08:58 AM
Post #3





Group: Members
Posts: 6
Joined: 27-November 09
Member No.: 10,452



thank you so much for the tips..i just viewed that link regarding mailto being unreliable but still not sure what to do or what to replace it with. When i fill out the test data in the form and click submit it notifies me that by clicking continue the information will be sent by email, however it tries to open up my outlook and send the email that way and by doing so none of the test info i filled out gets attached to it. I want to find a way i can have someone fill out that form, click submit and it just sends to my email without having to make you open up your outlook....not sure if im clear on what im saying bc im a very new to this process but hoping you can give me a few more tips...thank you so much
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Nov 27 2009, 09:56 AM
Post #4


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,716
Joined: 9-August 06
Member No.: 6



QUOTE
thank you so much for the tips..i just viewed that link regarding mailto being unreliable but still not sure what to do or what to replace it with.


A script on the server. If you can't run scripts, there are services.

QUOTE
When i fill out the test data in the form and click submit it notifies me that by clicking continue the information will be sent by email, however it tries to open up my outlook and send the email that way


That's what mailto does in the best case, if it works. If there is no email client configured to react on mailto, well, nothing much will happen.

QUOTE
and by doing so none of the test info i filled out gets attached to it.


Did you add enctype, method and name each input?

QUOTE
I want to find a way i can have someone fill out that form, click submit and it just sends to my email without having to make you open up your outlook....


Yeah, you don't want mailto then.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pong22
post Nov 27 2009, 10:01 AM
Post #5





Group: Members
Posts: 6
Joined: 27-November 09
Member No.: 10,452



Did you add enctype, method and name each input?
QUOTE
Did you add enctype, method and name each input?


i did add enctype and method but i did not name each input. Can you give me an example on what you mean by that? looking above at my first post i thought i did have input names???
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Nov 27 2009, 10:23 AM
Post #6


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,716
Joined: 9-August 06
Member No.: 6



See here: http://htmlhelp.com/reference/html40/forms/input.html . You could use for example full_name as the name for the one where they should enter their full name.

CODE
<input type="text" name="full_name">


Point is, what's returned to you is name - value pairs. The name you give the input. The value is what the user enters. When it works you will get a list of name - value pairs in the email, like so.
full_name=Charlie Brown
nother_name=Another value
...

If the form still doesn't work, paste what you have now in here.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pong22
post Nov 27 2009, 11:39 PM
Post #7





Group: Members
Posts: 6
Joined: 27-November 09
Member No.: 10,452



ok i think i gave names to the input but its still not working. when i click submit a Windoes Explorer message icon pops up and states "This form is being submitted using email. Submitting this form will reveal your email address to the recipient, and will send the form data without encrypting it for privacy..." When you click continue nothing happens, it doesnt open up outlook and just redirects me back to homepage. I like the redirection after the submission but not content is coming through email. Here is what i hav so far:

<form id="contacts-form" action="mailto:info@de-legal.com" enctype="multipart/form-data" method="post">
<fieldset>
<div class="field"><label>Full Name:</label><input type="text" name="Full Name" value=""/></div>
<div class="field"><label>E-mail:</label><input type="text" value="" name="E-mail" size="20"/></div>
<div class="field"><label>Law Firm:</label><input type="text" name="Law_Firm" value=""/></div>
<div class="field"><label>Address:</label><input type="text" name="Address" value=""/></div>
<div class="field"><label>City:</label><input type="text" name="City" value=""/></div>
<div class="field"><label>State:</label><input type="text" name="State" value=""/></div>
<div class="field"><label>Phone:</label><input type="text" name="Phone" value=""/></div>
<div class="field"><label>Message:</label><textarea cols="" rows=""></textarea></div>
<div class="alignright"><a href="" class="button" onclick="document.getElementById('contacts-form').submit()"('contacts-form').submit()"><em><b>Submit</b></em></a></div>
</fieldset>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post Nov 27 2009, 11:50 PM
Post #8


WDG Member
********

Group: Root Admin
Posts: 8,365
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



Please see the FAQ entry How do I get form data emailed to me?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Nov 28 2009, 12:01 AM
Post #9


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,716
Joined: 9-August 06
Member No.: 6



QUOTE(pong22 @ Nov 28 2009, 05:39 AM) *

enctype="multipart/form-data"


Did you look for an attachment on the email? That's what I get with the above enctype. With enctype="text/plain" I get the data in the body of the email. My attachment is called POSTDATA1.ATT. I don't know if this depends on the email client or not. I've almost always used Dora and it has always been like this.

Another thing - spaces aren't allowed in the value of 'name'. It may work for this, but it will screw other things up.
http://htmlhelp.com/reference/html40/values.html#id
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pong22
post Nov 28 2009, 12:15 AM
Post #10





Group: Members
Posts: 6
Joined: 27-November 09
Member No.: 10,452



ok i corrected the enctype to enctype="text/plain" and placed an underscore in "full_name" however nothing has changed. i am still recieving the dialog box saying it will be sent using email but when i chck my email nothing new comes in my inbox.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pong22
post Nov 28 2009, 12:34 AM
Post #11





Group: Members
Posts: 6
Joined: 27-November 09
Member No.: 10,452



Ok I tried this, not sure if im doing this right at all or if im making it worse. any thoughts???

<form id="contacts-form" action="http://www.tipjar.com/cgi-bin/generic" enctype="text/plain" method="post">
<input type="hidden" name="mailto" value="DRI">
<fieldset>
<div class="field"><label>Full Name:</label><input type="text" name="full_name" value=""/></div>
<div class="field"><label>E-mail:</label><input type="text" value="" name="E-mail" size="20"/></div>
<div class="field"><label>Law Firm:</label><input type="text" name="Law_Firm" value=""/></div>
<div class="field"><label>Address:</label><input type="text" name="Address" value=""/></div>
<div class="field"><label>City:</label><input type="text" name="City" value=""/></div>
<div class="field"><label>State:</label><input type="text" name="State" value=""/></div>
<div class="field"><label>Phone:</label><input type="text" name="Phone" value=""/></div>
<div class="field"><label>Message:</label><textarea cols="" rows=""></textarea></div>
<div class="alignright"><a href="" class="button" onclick="document.getElementById('contacts-form').submit()"('contacts-form').submit()"><em><b>Submit</b></em></a></div>
</fieldset>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Nov 28 2009, 01:07 AM
Post #12


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,716
Joined: 9-August 06
Member No.: 6



QUOTE(pong22 @ Nov 28 2009, 06:15 AM) *

ok i corrected the enctype to enctype="text/plain" and placed an underscore in "full_name" however nothing has changed. i am still recieving the dialog box saying it will be sent using email but when i chck my email nothing new comes in my inbox.


You won't get anything in your inbox untill you have actually sent the email to yourself. biggrin.gif

What do you do when you get the alert? You have to OK it. Then you should get another alert from your email program (at least I do). After that the email program should open with a prefilled email. Then you have to manually send it yourself.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Nov 28 2009, 01:08 AM
Post #13


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,716
Joined: 9-August 06
Member No.: 6



QUOTE(pong22 @ Nov 28 2009, 06:34 AM) *

Ok I tried this, not sure if im doing this right at all or if im making it worse. any thoughts???


I don't know. Do you have an actual script? Otherwise nothing will happen.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 28th March 2024 - 08:07 AM