send form data in email javascript or php

In web development it is very normal that we create 'Contact-Us' Form . And we want to ...


In web development it is very normal that we create 'Contact-Us' Form . And we want to send complete form submitted data in a mail to somebody (normally to ourself ).

There are many ways to do this .
1) using javascript
2) using any server side scripting like PHP .

To understand this first of all, we need to understand concept of sendmail utilites and mail server . for sending mail , we need to have a mail server or mail client . best example for mail client is MS-outlook and mail client is "mail" command in linux .
First way -- javascript  -->
As we know javascript is client side scripting , so it need a client to send mail i.e. mail client .
Example :-
lets take a simple form .
form.html


This is simplest example . If we try to see what happens here , we are using javascript "mailto" function . "mailto" will trigger mail client to send mail that means , it will call you MS-Outlook (if installed and configured ) .This way is not used widely as it is client dependent way and we don't have any control here .

Second way -- server side scripting e.g. PHP -->
php will need a mail server configured to send a mail . As we are developers we can control and configure mail server by our own .
Example :-
form.html



abc.php

Now this is stable and trusted code to send mails . And everyone should use this way of sending mail .

There are two ways of submitting form i.e. GET and POST . Both methods have their importances .
If we submit form using get method and then all data submitted will be append in the action page url . And we know that url have its limits so we can send only small amount of data using GET method .
While in POST method data is sent in the request body so there is no limit here to send data .
Also in GET method data is visible in th url , so it is not safe . Whenever we need to create safe application we should use POST method .
GET method is fast as everything is simply appended in the url . But in using POST method every request need to maintain data in the body . So it is lsightly time consuming method .

Both methods are useful . So we need to choose wisely according to our application taht which method we should use .

Thank you .

Keep visiting 
Name

android facebook free-zone Freebies hacking How-to programming scripts video whatsapp
false
ltr
item
Mr Tricks: send form data in email javascript or php
send form data in email javascript or php
http://1.bp.blogspot.com/-oQx-rG_neDo/VL8q0HfoSAI/AAAAAAAABDM/VBaVUlsD9Sw/s1600/photo.jpg
http://1.bp.blogspot.com/-oQx-rG_neDo/VL8q0HfoSAI/AAAAAAAABDM/VBaVUlsD9Sw/s72-c/photo.jpg
Mr Tricks
http://mr-tricks.blogspot.com/2015/01/send-form-data-in-email-javascript-or.html
http://mr-tricks.blogspot.com/
http://mr-tricks.blogspot.com/
http://mr-tricks.blogspot.com/2015/01/send-form-data-in-email-javascript-or.html
true
248440411475805434
UTF-8
Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy